7
7
# --------------------------------------------------------------------------
8
8
9
9
from copy import deepcopy
10
- from typing import Any , TYPE_CHECKING
10
+ from typing import Any , Optional , TYPE_CHECKING , cast
11
11
from typing_extensions import Self
12
12
13
13
from azure .core .pipeline import policies
14
14
from azure .core .rest import HttpRequest , HttpResponse
15
+ from azure .core .settings import settings
15
16
from azure .mgmt .core import ARMPipelineClient
16
17
from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
18
+ from azure .mgmt .core .tools import get_arm_endpoints
17
19
18
20
from . import models as _models
19
21
from ._configuration import PrivateDnsManagementClientConfiguration
20
- from ._serialization import Deserializer , Serializer
22
+ from ._utils . serialization import Deserializer , Serializer
21
23
from .operations import PrivateZonesOperations , RecordSetsOperations , VirtualNetworkLinksOperations
22
24
23
25
if TYPE_CHECKING :
24
- # pylint: disable=unused-import,ungrouped-imports
25
26
from azure .core .credentials import TokenCredential
26
27
27
28
28
- class PrivateDnsManagementClient : # pylint: disable=client-accepts-api-version-keyword
29
+ class PrivateDnsManagementClient :
29
30
"""The Private DNS Management Client.
30
31
31
32
:ivar private_zones: PrivateZonesOperations operations
32
33
: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
35
34
:ivar record_sets: RecordSetsOperations operations
36
35
: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
37
38
:param credential: Credential needed for the client to connect to Azure. Required.
38
39
: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.
41
41
: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 .
43
43
:type base_url: str
44
44
:keyword api_version: Api Version. Default value is "2024-06-01". Note that overriding this
45
45
default value may result in unsupported behavior.
@@ -49,15 +49,17 @@ class PrivateDnsManagementClient: # pylint: disable=client-accepts-api-version-
49
49
"""
50
50
51
51
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
57
53
) -> 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" ])
58
59
self ._config = PrivateDnsManagementClientConfiguration (
59
- credential = credential , subscription_id = subscription_id , ** kwargs
60
+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
60
61
)
62
+
61
63
_policies = kwargs .pop ("policies" , None )
62
64
if _policies is None :
63
65
_policies = [
@@ -76,17 +78,17 @@ def __init__(
76
78
policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
77
79
self ._config .http_logging_policy ,
78
80
]
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 )
80
82
81
83
client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
82
84
self ._serialize = Serializer (client_models )
83
85
self ._deserialize = Deserializer (client_models )
84
86
self ._serialize .client_side_validation = False
85
87
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 )
86
89
self .virtual_network_links = VirtualNetworkLinksOperations (
87
90
self ._client , self ._config , self ._serialize , self ._deserialize
88
91
)
89
- self .record_sets = RecordSetsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
90
92
91
93
def _send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
92
94
"""Runs the network request through the client's chained policies.
0 commit comments