8
8
9
9
from copy import deepcopy
10
10
from typing import Any , TYPE_CHECKING
11
+ from typing_extensions import Self
11
12
13
+ from azure .core .pipeline import policies
12
14
from azure .core .rest import HttpRequest , HttpResponse
13
15
from azure .mgmt .core import ARMPipelineClient
16
+ from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
14
17
15
18
from . import models as _models
16
19
from ._configuration import DnsResolverManagementClientConfiguration
17
20
from ._serialization import Deserializer , Serializer
18
21
from .operations import (
19
22
DnsForwardingRulesetsOperations ,
23
+ DnsResolverDomainListsOperations ,
24
+ DnsResolverPoliciesOperations ,
25
+ DnsResolverPolicyVirtualNetworkLinksOperations ,
20
26
DnsResolversOperations ,
27
+ DnsSecurityRulesOperations ,
21
28
ForwardingRulesOperations ,
22
29
InboundEndpointsOperations ,
23
30
OutboundEndpointsOperations ,
29
36
from azure .core .credentials import TokenCredential
30
37
31
38
32
- class DnsResolverManagementClient : # pylint: disable=client-accepts-api-version-keyword
33
- """The DNS Resolver Management Client.
39
+ class DnsResolverManagementClient : # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
40
+ """DNS Resolver Client.
34
41
35
42
:ivar dns_resolvers: DnsResolversOperations operations
36
43
:vartype dns_resolvers: azure.mgmt.dnsresolver.operations.DnsResolversOperations
@@ -45,14 +52,25 @@ class DnsResolverManagementClient: # pylint: disable=client-accepts-api-version
45
52
:vartype forwarding_rules: azure.mgmt.dnsresolver.operations.ForwardingRulesOperations
46
53
:ivar virtual_network_links: VirtualNetworkLinksOperations operations
47
54
:vartype virtual_network_links: azure.mgmt.dnsresolver.operations.VirtualNetworkLinksOperations
55
+ :ivar dns_resolver_policies: DnsResolverPoliciesOperations operations
56
+ :vartype dns_resolver_policies: azure.mgmt.dnsresolver.operations.DnsResolverPoliciesOperations
57
+ :ivar dns_security_rules: DnsSecurityRulesOperations operations
58
+ :vartype dns_security_rules: azure.mgmt.dnsresolver.operations.DnsSecurityRulesOperations
59
+ :ivar dns_resolver_policy_virtual_network_links: DnsResolverPolicyVirtualNetworkLinksOperations
60
+ operations
61
+ :vartype dns_resolver_policy_virtual_network_links:
62
+ azure.mgmt.dnsresolver.operations.DnsResolverPolicyVirtualNetworkLinksOperations
63
+ :ivar dns_resolver_domain_lists: DnsResolverDomainListsOperations operations
64
+ :vartype dns_resolver_domain_lists:
65
+ azure.mgmt.dnsresolver.operations.DnsResolverDomainListsOperations
48
66
:param credential: Credential needed for the client to connect to Azure. Required.
49
67
:type credential: ~azure.core.credentials.TokenCredential
50
- :param subscription_id: The ID of the target subscription. Required.
68
+ :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
51
69
:type subscription_id: str
52
70
:param base_url: Service URL. Default value is "https://management.azure.com".
53
71
:type base_url: str
54
- :keyword api_version: Api Version. Default value is "2022 -07-01". Note that overriding this
55
- default value may result in unsupported behavior.
72
+ :keyword api_version: Api Version. Default value is "2023 -07-01-preview ". Note that overriding
73
+ this default value may result in unsupported behavior.
56
74
:paramtype api_version: str
57
75
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
58
76
Retry-After header is present.
@@ -68,7 +86,25 @@ def __init__(
68
86
self ._config = DnsResolverManagementClientConfiguration (
69
87
credential = credential , subscription_id = subscription_id , ** kwargs
70
88
)
71
- self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
89
+ _policies = kwargs .pop ("policies" , None )
90
+ if _policies is None :
91
+ _policies = [
92
+ policies .RequestIdPolicy (** kwargs ),
93
+ self ._config .headers_policy ,
94
+ self ._config .user_agent_policy ,
95
+ self ._config .proxy_policy ,
96
+ policies .ContentDecodePolicy (** kwargs ),
97
+ ARMAutoResourceProviderRegistrationPolicy (),
98
+ self ._config .redirect_policy ,
99
+ self ._config .retry_policy ,
100
+ self ._config .authentication_policy ,
101
+ self ._config .custom_hook_policy ,
102
+ self ._config .logging_policy ,
103
+ policies .DistributedTracingPolicy (** kwargs ),
104
+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
105
+ self ._config .http_logging_policy ,
106
+ ]
107
+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
72
108
73
109
client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
74
110
self ._serialize = Serializer (client_models )
@@ -90,8 +126,20 @@ def __init__(
90
126
self .virtual_network_links = VirtualNetworkLinksOperations (
91
127
self ._client , self ._config , self ._serialize , self ._deserialize
92
128
)
129
+ self .dns_resolver_policies = DnsResolverPoliciesOperations (
130
+ self ._client , self ._config , self ._serialize , self ._deserialize
131
+ )
132
+ self .dns_security_rules = DnsSecurityRulesOperations (
133
+ self ._client , self ._config , self ._serialize , self ._deserialize
134
+ )
135
+ self .dns_resolver_policy_virtual_network_links = DnsResolverPolicyVirtualNetworkLinksOperations (
136
+ self ._client , self ._config , self ._serialize , self ._deserialize
137
+ )
138
+ self .dns_resolver_domain_lists = DnsResolverDomainListsOperations (
139
+ self ._client , self ._config , self ._serialize , self ._deserialize
140
+ )
93
141
94
- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
142
+ def _send_request (self , request : HttpRequest , * , stream : bool = False , * *kwargs : Any ) -> HttpResponse :
95
143
"""Runs the network request through the client's chained policies.
96
144
97
145
>>> from azure.core.rest import HttpRequest
@@ -111,14 +159,14 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
111
159
112
160
request_copy = deepcopy (request )
113
161
request_copy .url = self ._client .format_url (request_copy .url )
114
- return self ._client .send_request (request_copy , ** kwargs )
162
+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
115
163
116
164
def close (self ) -> None :
117
165
self ._client .close ()
118
166
119
- def __enter__ (self ) -> "DnsResolverManagementClient" :
167
+ def __enter__ (self ) -> Self :
120
168
self ._client .__enter__ ()
121
169
return self
122
170
123
- def __exit__ (self , * exc_details ) -> None :
171
+ def __exit__ (self , * exc_details : Any ) -> None :
124
172
self ._client .__exit__ (* exc_details )
0 commit comments