77# --------------------------------------------------------------------------
88
99from copy import deepcopy
10- from typing import Any , TYPE_CHECKING
10+ from typing import Any , Optional , TYPE_CHECKING , cast
1111from typing_extensions import Self
1212
1313from azure .core .pipeline import policies
1414from azure .core .rest import HttpRequest , HttpResponse
15+ from azure .core .settings import settings
1516from azure .mgmt .core import ARMPipelineClient
1617from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
18+ from azure .mgmt .core .tools import get_arm_endpoints
1719
1820from . import models as _models
1921from ._configuration import PrivateDnsManagementClientConfiguration
20- from ._serialization import Deserializer , Serializer
22+ from ._utils . serialization import Deserializer , Serializer
2123from .operations import PrivateZonesOperations , RecordSetsOperations , VirtualNetworkLinksOperations
2224
2325if TYPE_CHECKING :
24- # pylint: disable=unused-import,ungrouped-imports
2526 from azure .core .credentials import TokenCredential
2627
2728
28- class PrivateDnsManagementClient : # pylint: disable=client-accepts-api-version-keyword
29+ class PrivateDnsManagementClient :
2930 """The Private DNS Management Client.
3031
3132 :ivar private_zones: PrivateZonesOperations operations
3233 :vartype private_zones: azure.mgmt.privatedns.operations.PrivateZonesOperations
33- :ivar virtual_network_links: VirtualNetworkLinksOperations operations
34- :vartype virtual_network_links: azure.mgmt.privatedns.operations.VirtualNetworkLinksOperations
3534 :ivar record_sets: RecordSetsOperations operations
3635 :vartype record_sets: azure.mgmt.privatedns.operations.RecordSetsOperations
36+ :ivar virtual_network_links: VirtualNetworkLinksOperations operations
37+ :vartype virtual_network_links: azure.mgmt.privatedns.operations.VirtualNetworkLinksOperations
3738 :param credential: Credential needed for the client to connect to Azure. Required.
3839 :type credential: ~azure.core.credentials.TokenCredential
39- :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure
40- subscription. The subscription ID forms part of the URI for every service call. Required.
40+ :param subscription_id: The ID of the target subscription. Required.
4141 :type subscription_id: str
42- :param base_url: Service URL. Default value is "https://management.azure.com" .
42+ :param base_url: Service URL. Default value is None .
4343 :type base_url: str
4444 :keyword api_version: Api Version. Default value is "2024-06-01". Note that overriding this
4545 default value may result in unsupported behavior.
@@ -49,15 +49,17 @@ class PrivateDnsManagementClient: # pylint: disable=client-accepts-api-version-
4949 """
5050
5151 def __init__ (
52- self ,
53- credential : "TokenCredential" ,
54- subscription_id : str ,
55- base_url : str = "https://management.azure.com" ,
56- ** kwargs : Any
52+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
5753 ) -> None :
54+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
55+ _endpoints = get_arm_endpoints (_cloud )
56+ if not base_url :
57+ base_url = _endpoints ["resource_manager" ]
58+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
5859 self ._config = PrivateDnsManagementClientConfiguration (
59- credential = credential , subscription_id = subscription_id , ** kwargs
60+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
6061 )
62+
6163 _policies = kwargs .pop ("policies" , None )
6264 if _policies is None :
6365 _policies = [
@@ -76,17 +78,17 @@ def __init__(
7678 policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
7779 self ._config .http_logging_policy ,
7880 ]
79- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
81+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , base_url ) , policies = _policies , ** kwargs )
8082
8183 client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
8284 self ._serialize = Serializer (client_models )
8385 self ._deserialize = Deserializer (client_models )
8486 self ._serialize .client_side_validation = False
8587 self .private_zones = PrivateZonesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
88+ self .record_sets = RecordSetsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
8689 self .virtual_network_links = VirtualNetworkLinksOperations (
8790 self ._client , self ._config , self ._serialize , self ._deserialize
8891 )
89- self .record_sets = RecordSetsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
9092
9193 def _send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
9294 """Runs the network request through the client's chained policies.
0 commit comments