88
99from copy import deepcopy
1010from typing import Any , TYPE_CHECKING
11+ from typing_extensions import Self
1112
13+ from azure .core .pipeline import policies
1214from azure .core .rest import HttpRequest , HttpResponse
1315from azure .mgmt .core import ARMPipelineClient
16+ from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
1417
1518from . import models as _models
1619from ._configuration import KustoManagementClientConfiguration
3538)
3639
3740if TYPE_CHECKING :
38- # pylint: disable=unused-import,ungrouped-imports
3941 from azure .core .credentials import TokenCredential
4042
4143
42- class KustoManagementClient : # pylint: disable=client-accepts-api-version-keyword, too-many-instance-attributes
44+ class KustoManagementClient : # pylint: disable=too-many-instance-attributes
4345 """The Azure Kusto management API provides a RESTful set of web services that interact with Azure
4446 Kusto services to manage your clusters and databases. The API enables you to create, update,
4547 and delete clusters and databases.
@@ -88,7 +90,7 @@ class KustoManagementClient: # pylint: disable=client-accepts-api-version-keywo
8890 :type subscription_id: str
8991 :param base_url: Service URL. Default value is "https://management.azure.com".
9092 :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
9294 default value may result in unsupported behavior.
9395 :paramtype api_version: str
9496 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
@@ -105,7 +107,25 @@ def __init__(
105107 self ._config = KustoManagementClientConfiguration (
106108 credential = credential , subscription_id = subscription_id , ** kwargs
107109 )
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 )
109129
110130 client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
111131 self ._serialize = Serializer (client_models )
@@ -148,7 +168,7 @@ def __init__(
148168 self ._client , self ._config , self ._serialize , self ._deserialize
149169 )
150170
151- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
171+ def _send_request (self , request : HttpRequest , * , stream : bool = False , * *kwargs : Any ) -> HttpResponse :
152172 """Runs the network request through the client's chained policies.
153173
154174 >>> from azure.core.rest import HttpRequest
@@ -168,12 +188,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
168188
169189 request_copy = deepcopy (request )
170190 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
172192
173193 def close (self ) -> None :
174194 self ._client .close ()
175195
176- def __enter__ (self ) -> "KustoManagementClient" :
196+ def __enter__ (self ) -> Self :
177197 self ._client .__enter__ ()
178198 return self
179199
0 commit comments