77# --------------------------------------------------------------------------
88
99from copy import deepcopy
10- from typing import Any , TYPE_CHECKING
10+ from typing import Any , Optional , TYPE_CHECKING , cast
11+ from typing_extensions import Self
1112
1213from azure .core .pipeline import policies
1314from azure .core .rest import HttpRequest , HttpResponse
15+ from azure .core .settings import settings
1416from azure .mgmt .core import ARMPipelineClient
1517from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
18+ from azure .mgmt .core .tools import get_arm_endpoints
1619
1720from . import models as _models
1821from ._configuration import NotificationHubsManagementClientConfiguration
19- from ._serialization import Deserializer , Serializer
22+ from ._utils . serialization import Deserializer , Serializer
2023from .operations import (
2124 NamespacesOperations ,
2225 NotificationHubsOperations ,
2528)
2629
2730if TYPE_CHECKING :
28- # pylint: disable=unused-import,ungrouped-imports
2931 from azure .core .credentials import TokenCredential
3032
3133
32- class NotificationHubsManagementClient : # pylint: disable=client-accepts-api-version-keyword
34+ class NotificationHubsManagementClient :
3335 """Microsoft Notification Hubs Resource Provider REST API.
3436
35- :ivar notification_hubs: NotificationHubsOperations operations
36- :vartype notification_hubs: azure.mgmt.notificationhubs.operations.NotificationHubsOperations
37- :ivar namespaces: NamespacesOperations operations
38- :vartype namespaces: azure.mgmt.notificationhubs.operations.NamespacesOperations
3937 :ivar operations: Operations operations
4038 :vartype operations: azure.mgmt.notificationhubs.operations.Operations
39+ :ivar namespaces: NamespacesOperations operations
40+ :vartype namespaces: azure.mgmt.notificationhubs.operations.NamespacesOperations
41+ :ivar notification_hubs: NotificationHubsOperations operations
42+ :vartype notification_hubs: azure.mgmt.notificationhubs.operations.NotificationHubsOperations
4143 :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
4244 :vartype private_endpoint_connections:
4345 azure.mgmt.notificationhubs.operations.PrivateEndpointConnectionsOperations
4446 :param credential: Credential needed for the client to connect to Azure. Required.
4547 :type credential: ~azure.core.credentials.TokenCredential
4648 :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
4749 :type subscription_id: str
48- :param base_url: Service URL. Default value is "https://management.azure.com" .
50+ :param base_url: Service URL. Default value is None .
4951 :type base_url: str
5052 :keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding
5153 this default value may result in unsupported behavior.
@@ -55,15 +57,17 @@ class NotificationHubsManagementClient: # pylint: disable=client-accepts-api-ve
5557 """
5658
5759 def __init__ (
58- self ,
59- credential : "TokenCredential" ,
60- subscription_id : str ,
61- base_url : str = "https://management.azure.com" ,
62- ** kwargs : Any
60+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
6361 ) -> None :
62+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
63+ _endpoints = get_arm_endpoints (_cloud )
64+ if not base_url :
65+ base_url = _endpoints ["resource_manager" ]
66+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
6467 self ._config = NotificationHubsManagementClientConfiguration (
65- credential = credential , subscription_id = subscription_id , ** kwargs
68+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
6669 )
70+
6771 _policies = kwargs .pop ("policies" , None )
6872 if _policies is None :
6973 _policies = [
@@ -82,17 +86,17 @@ def __init__(
8286 policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
8387 self ._config .http_logging_policy ,
8488 ]
85- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
89+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , base_url ) , policies = _policies , ** kwargs )
8690
8791 client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
8892 self ._serialize = Serializer (client_models )
8993 self ._deserialize = Deserializer (client_models )
9094 self ._serialize .client_side_validation = False
95+ self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
96+ self .namespaces = NamespacesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
9197 self .notification_hubs = NotificationHubsOperations (
9298 self ._client , self ._config , self ._serialize , self ._deserialize
9399 )
94- self .namespaces = NamespacesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
95- self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
96100 self .private_endpoint_connections = PrivateEndpointConnectionsOperations (
97101 self ._client , self ._config , self ._serialize , self ._deserialize
98102 )
@@ -122,7 +126,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
122126 def close (self ) -> None :
123127 self ._client .close ()
124128
125- def __enter__ (self ) -> "NotificationHubsManagementClient" :
129+ def __enter__ (self ) -> Self :
126130 self ._client .__enter__ ()
127131 return self
128132
0 commit comments