8
8
9
9
from copy import deepcopy
10
10
from typing import Any , TYPE_CHECKING
11
+ from typing_extensions import Self
11
12
13
+ from azure .core .pipeline import policies
12
14
from azure .core .rest import HttpRequest , HttpResponse
13
15
from azure .mgmt .core import ARMPipelineClient
16
+ from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
14
17
15
18
from . import models as _models
16
19
from ._configuration import KustoManagementClientConfiguration
35
38
)
36
39
37
40
if TYPE_CHECKING :
38
- # pylint: disable=unused-import,ungrouped-imports
39
41
from azure .core .credentials import TokenCredential
40
42
41
43
42
- class KustoManagementClient : # pylint: disable=client-accepts-api-version-keyword, too-many-instance-attributes
44
+ class KustoManagementClient : # pylint: disable=too-many-instance-attributes
43
45
"""The Azure Kusto management API provides a RESTful set of web services that interact with Azure
44
46
Kusto services to manage your clusters and databases. The API enables you to create, update,
45
47
and delete clusters and databases.
@@ -88,7 +90,7 @@ class KustoManagementClient: # pylint: disable=client-accepts-api-version-keywo
88
90
:type subscription_id: str
89
91
:param base_url: Service URL. Default value is "https://management.azure.com".
90
92
:type base_url: str
91
- :keyword api_version: Api Version. Default value is "2023-08-15 ". Note that overriding this
93
+ :keyword api_version: Api Version. Default value is "2024-04-13 ". Note that overriding this
92
94
default value may result in unsupported behavior.
93
95
:paramtype api_version: str
94
96
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
@@ -105,7 +107,25 @@ def __init__(
105
107
self ._config = KustoManagementClientConfiguration (
106
108
credential = credential , subscription_id = subscription_id , ** kwargs
107
109
)
108
- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
110
+ _policies = kwargs .pop ("policies" , None )
111
+ if _policies is None :
112
+ _policies = [
113
+ policies .RequestIdPolicy (** kwargs ),
114
+ self ._config .headers_policy ,
115
+ self ._config .user_agent_policy ,
116
+ self ._config .proxy_policy ,
117
+ policies .ContentDecodePolicy (** kwargs ),
118
+ ARMAutoResourceProviderRegistrationPolicy (),
119
+ self ._config .redirect_policy ,
120
+ self ._config .retry_policy ,
121
+ self ._config .authentication_policy ,
122
+ self ._config .custom_hook_policy ,
123
+ self ._config .logging_policy ,
124
+ policies .DistributedTracingPolicy (** kwargs ),
125
+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
126
+ self ._config .http_logging_policy ,
127
+ ]
128
+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
109
129
110
130
client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
111
131
self ._serialize = Serializer (client_models )
@@ -148,7 +168,7 @@ def __init__(
148
168
self ._client , self ._config , self ._serialize , self ._deserialize
149
169
)
150
170
151
- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
171
+ def _send_request (self , request : HttpRequest , * , stream : bool = False , * *kwargs : Any ) -> HttpResponse :
152
172
"""Runs the network request through the client's chained policies.
153
173
154
174
>>> from azure.core.rest import HttpRequest
@@ -168,12 +188,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
168
188
169
189
request_copy = deepcopy (request )
170
190
request_copy .url = self ._client .format_url (request_copy .url )
171
- return self ._client .send_request (request_copy , ** kwargs )
191
+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
172
192
173
193
def close (self ) -> None :
174
194
self ._client .close ()
175
195
176
- def __enter__ (self ) -> "KustoManagementClient" :
196
+ def __enter__ (self ) -> Self :
177
197
self ._client .__enter__ ()
178
198
return self
179
199
0 commit comments