1111
1212from typing import Any , Optional , TYPE_CHECKING
1313
14+ from azure .core .pipeline import policies
1415from azure .mgmt .core import ARMPipelineClient
16+ from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
1517from azure .profiles import KnownProfiles , ProfileDefinition
1618from azure .profiles .multiapiclient import MultiApiClientMixin
1719
@@ -72,8 +74,28 @@ def __init__(
7274 profile : KnownProfiles = KnownProfiles .default ,
7375 ** kwargs : Any
7476 ):
77+ if api_version :
78+ kwargs .setdefault ('api_version' , api_version )
7579 self ._config = EventHubManagementClientConfiguration (credential , subscription_id , ** kwargs )
76- self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
80+ _policies = kwargs .pop ("policies" , None )
81+ if _policies is None :
82+ _policies = [
83+ policies .RequestIdPolicy (** kwargs ),
84+ self ._config .headers_policy ,
85+ self ._config .user_agent_policy ,
86+ self ._config .proxy_policy ,
87+ policies .ContentDecodePolicy (** kwargs ),
88+ ARMAutoResourceProviderRegistrationPolicy (),
89+ self ._config .redirect_policy ,
90+ self ._config .retry_policy ,
91+ self ._config .authentication_policy ,
92+ self ._config .custom_hook_policy ,
93+ self ._config .logging_policy ,
94+ policies .DistributedTracingPolicy (** kwargs ),
95+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
96+ self ._config .http_logging_policy ,
97+ ]
98+ self ._client = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
7799 super (EventHubManagementClient , self ).__init__ (
78100 api_version = api_version ,
79101 profile = profile
@@ -137,7 +159,7 @@ def application_group(self):
137159 else :
138160 raise ValueError ("API version {} does not have operation group 'application_group'" .format (api_version ))
139161 self ._config .api_version = api_version
140- return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )))
162+ return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )), api_version )
141163
142164 @property
143165 def clusters (self ):
@@ -163,7 +185,7 @@ def clusters(self):
163185 else :
164186 raise ValueError ("API version {} does not have operation group 'clusters'" .format (api_version ))
165187 self ._config .api_version = api_version
166- return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )))
188+ return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )), api_version )
167189
168190 @property
169191 def configuration (self ):
@@ -189,7 +211,7 @@ def configuration(self):
189211 else :
190212 raise ValueError ("API version {} does not have operation group 'configuration'" .format (api_version ))
191213 self ._config .api_version = api_version
192- return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )))
214+ return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )), api_version )
193215
194216 @property
195217 def consumer_groups (self ):
@@ -224,7 +246,7 @@ def consumer_groups(self):
224246 else :
225247 raise ValueError ("API version {} does not have operation group 'consumer_groups'" .format (api_version ))
226248 self ._config .api_version = api_version
227- return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )))
249+ return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )), api_version )
228250
229251 @property
230252 def disaster_recovery_configs (self ):
@@ -256,7 +278,7 @@ def disaster_recovery_configs(self):
256278 else :
257279 raise ValueError ("API version {} does not have operation group 'disaster_recovery_configs'" .format (api_version ))
258280 self ._config .api_version = api_version
259- return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )))
281+ return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )), api_version )
260282
261283 @property
262284 def event_hubs (self ):
@@ -291,7 +313,7 @@ def event_hubs(self):
291313 else :
292314 raise ValueError ("API version {} does not have operation group 'event_hubs'" .format (api_version ))
293315 self ._config .api_version = api_version
294- return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )))
316+ return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )), api_version )
295317
296318 @property
297319 def namespaces (self ):
@@ -326,7 +348,7 @@ def namespaces(self):
326348 else :
327349 raise ValueError ("API version {} does not have operation group 'namespaces'" .format (api_version ))
328350 self ._config .api_version = api_version
329- return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )))
351+ return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )), api_version )
330352
331353 @property
332354 def network_security_perimeter_configuration (self ):
@@ -343,7 +365,7 @@ def network_security_perimeter_configuration(self):
343365 else :
344366 raise ValueError ("API version {} does not have operation group 'network_security_perimeter_configuration'" .format (api_version ))
345367 self ._config .api_version = api_version
346- return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )))
368+ return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )), api_version )
347369
348370 @property
349371 def network_security_perimeter_configurations (self ):
@@ -360,7 +382,7 @@ def network_security_perimeter_configurations(self):
360382 else :
361383 raise ValueError ("API version {} does not have operation group 'network_security_perimeter_configurations'" .format (api_version ))
362384 self ._config .api_version = api_version
363- return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )))
385+ return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )), api_version )
364386
365387 @property
366388 def operations (self ):
@@ -395,7 +417,7 @@ def operations(self):
395417 else :
396418 raise ValueError ("API version {} does not have operation group 'operations'" .format (api_version ))
397419 self ._config .api_version = api_version
398- return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )))
420+ return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )), api_version )
399421
400422 @property
401423 def private_endpoint_connections (self ):
@@ -424,7 +446,7 @@ def private_endpoint_connections(self):
424446 else :
425447 raise ValueError ("API version {} does not have operation group 'private_endpoint_connections'" .format (api_version ))
426448 self ._config .api_version = api_version
427- return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )))
449+ return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )), api_version )
428450
429451 @property
430452 def private_link_resources (self ):
@@ -453,7 +475,7 @@ def private_link_resources(self):
453475 else :
454476 raise ValueError ("API version {} does not have operation group 'private_link_resources'" .format (api_version ))
455477 self ._config .api_version = api_version
456- return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )))
478+ return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )), api_version )
457479
458480 @property
459481 def regions (self ):
@@ -470,7 +492,7 @@ def regions(self):
470492 else :
471493 raise ValueError ("API version {} does not have operation group 'regions'" .format (api_version ))
472494 self ._config .api_version = api_version
473- return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )))
495+ return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )), api_version )
474496
475497 @property
476498 def schema_registry (self ):
@@ -490,7 +512,7 @@ def schema_registry(self):
490512 else :
491513 raise ValueError ("API version {} does not have operation group 'schema_registry'" .format (api_version ))
492514 self ._config .api_version = api_version
493- return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )))
515+ return OperationClass (self ._client , self ._config , Serializer (self ._models_dict (api_version )), Deserializer (self ._models_dict (api_version )), api_version )
494516
495517 def close (self ):
496518 self ._client .close ()
0 commit comments