Skip to content

Commit b176262

Browse files
azure-sdkChenxiJiang333msyyc
authored andcommitted
[AutoRelease] t2-dnsresolver-2024-10-12-16936(can only be merged by SDK owner) (Azure#37864)
* code and test * update-testcase * Update CHANGELOG.md * Update CHANGELOG.md --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: Yuchao Yan <[email protected]>
1 parent 52d04f2 commit b176262

File tree

126 files changed

+14380
-3007
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+14380
-3007
lines changed

sdk/dnsresolver/azure-mgmt-dnsresolver/CHANGELOG.md

+33
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
11
# Release History
22

3+
## 1.1.0b2 (2024-XX-XX)
4+
5+
### Features Added
6+
7+
- Client `DnsResolverManagementClient` added operation group `dns_resolver_policies`
8+
- Client `DnsResolverManagementClient` added operation group `dns_security_rules`
9+
- Client `DnsResolverManagementClient` added operation group `dns_resolver_policy_virtual_network_links`
10+
- Client `DnsResolverManagementClient` added operation group `dns_resolver_domain_lists`
11+
- Model `Resource` added property `system_data`
12+
- Added enum `ActionType`
13+
- Added enum `BlockResponseCode`
14+
- Added model `DnsResolverDomainList`
15+
- Added model `DnsResolverDomainListPatch`
16+
- Added model `DnsResolverDomainListResult`
17+
- Added model `DnsResolverPolicy`
18+
- Added model `DnsResolverPolicyListResult`
19+
- Added model `DnsResolverPolicyPatch`
20+
- Added model `DnsResolverPolicyVirtualNetworkLink`
21+
- Added model `DnsResolverPolicyVirtualNetworkLinkListResult`
22+
- Added model `DnsResolverPolicyVirtualNetworkLinkPatch`
23+
- Added model `DnsSecurityRule`
24+
- Added model `DnsSecurityRuleAction`
25+
- Added model `DnsSecurityRuleListResult`
26+
- Added model `DnsSecurityRulePatch`
27+
- Added enum `DnsSecurityRuleState`
28+
- Added model `ErrorAdditionalInfo`
29+
- Added model `ErrorDetail`
30+
- Added model `ErrorResponse`
31+
- Added model `DnsResolverDomainListsOperations`
32+
- Added model `DnsResolverPoliciesOperations`
33+
- Added model `DnsResolverPolicyVirtualNetworkLinksOperations`
34+
- Added model `DnsSecurityRulesOperations`
35+
336
## 1.1.0b1 (2022-12-27)
437

538
### Other Changes

sdk/dnsresolver/azure-mgmt-dnsresolver/README.md

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Microsoft Azure SDK for Python
22

33
This is the Microsoft Azure Dnsresolver Management Client Library.
4-
This package has been tested with Python 3.7+.
4+
This package has been tested with Python 3.8+.
55
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
66

77
## _Disclaimer_
@@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For
1212

1313
### Prerequisites
1414

15-
- Python 3.7+ is required to use this package.
15+
- Python 3.8+ is required to use this package.
1616
- [Azure subscription](https://azure.microsoft.com/free/)
1717

1818
### Install the package
@@ -28,25 +28,26 @@ By default, [Azure Active Directory](https://aka.ms/awps/aad) token authenticati
2828

2929
- `AZURE_CLIENT_ID` for Azure client ID.
3030
- `AZURE_TENANT_ID` for Azure tenant ID.
31-
- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate.
31+
- `AZURE_CLIENT_SECRET` for Azure client secret.
3232

3333
In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`.
3434

3535
With above configuration, client can be authenticated by following code:
3636

3737
```python
3838
from azure.identity import DefaultAzureCredential
39-
from azure.mgmt.dnsresolver import DnsResolverManagementClient
39+
from azure.mgmt.dnsresolver import DnsresolverManagementClient
4040
import os
4141

4242
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
43-
client = DnsResolverManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
43+
client = DnsresolverManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
4444
```
4545

4646
## Examples
4747

48-
49-
Code samples for this package can be found at [Dnsresolver Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
48+
Code samples for this package can be found at:
49+
- [Search Dnsresolver Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com
50+
- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
5051

5152

5253
## Troubleshooting
@@ -58,6 +59,3 @@ Code samples for this package can be found at [Dnsresolver Management](https://d
5859
If you encounter any bugs or have suggestions, please file an issue in the
5960
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
6061
section of the project.
61-
62-
63-
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-dnsresolver%2FREADME.png)
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "89a9bf17524904e7670f0fd2d62ac882ca00d85c",
2+
"commit": "15b16d1b5c3cccdecdd1cfe936f6a8005680c557",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.9.2",
4+
"autorest": "3.10.2",
55
"use": [
6-
"@autorest/python@6.2.7",
7-
"@autorest/modelerfour@4.24.3"
6+
"@autorest/python@6.19.0",
7+
"@autorest/modelerfour@4.27.0"
88
],
9-
"autorest_command": "autorest specification/dnsresolver/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
9+
"autorest_command": "autorest specification/dnsresolver/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
1010
"readme": "specification/dnsresolver/resource-manager/readme.md"
1111
}

sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/_configuration.py

+7-14
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,35 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
import sys
109
from typing import Any, TYPE_CHECKING
1110

12-
from azure.core.configuration import Configuration
1311
from azure.core.pipeline import policies
1412
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1513

1614
from ._version import VERSION
1715

18-
if sys.version_info >= (3, 8):
19-
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
20-
else:
21-
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
22-
2316
if TYPE_CHECKING:
2417
# pylint: disable=unused-import,ungrouped-imports
2518
from azure.core.credentials import TokenCredential
2619

2720

28-
class DnsResolverManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
21+
class DnsResolverManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
2922
"""Configuration for DnsResolverManagementClient.
3023
3124
Note that all parameters used to create this instance are saved as instance
3225
attributes.
3326
3427
:param credential: Credential needed for the client to connect to Azure. Required.
3528
:type credential: ~azure.core.credentials.TokenCredential
36-
:param subscription_id: The ID of the target subscription. Required.
29+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3730
:type subscription_id: str
38-
:keyword api_version: Api Version. Default value is "2022-07-01". Note that overriding this
39-
default value may result in unsupported behavior.
31+
:keyword api_version: Api Version. Default value is "2023-07-01-preview". Note that overriding
32+
this default value may result in unsupported behavior.
4033
:paramtype api_version: str
4134
"""
4235

4336
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
44-
super(DnsResolverManagementClientConfiguration, self).__init__(**kwargs)
45-
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", "2022-07-01")
37+
api_version: str = kwargs.pop("api_version", "2023-07-01-preview")
4638

4739
if credential is None:
4840
raise ValueError("Parameter 'credential' must not be None.")
@@ -54,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
5446
self.api_version = api_version
5547
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
5648
kwargs.setdefault("sdk_moniker", "mgmt-dnsresolver/{}".format(VERSION))
49+
self.polling_interval = kwargs.get("polling_interval", 30)
5750
self._configure(**kwargs)
5851

5952
def _configure(self, **kwargs: Any) -> None:
@@ -62,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None:
6255
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
6356
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
6457
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
65-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6658
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
6759
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
60+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6861
self.authentication_policy = kwargs.get("authentication_policy")
6962
if self.credential and not self.authentication_policy:
7063
self.authentication_policy = ARMChallengeAuthenticationPolicy(

sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/_dns_resolver_management_client.py

+58-10
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,23 @@
88

99
from copy import deepcopy
1010
from typing import Any, TYPE_CHECKING
11+
from typing_extensions import Self
1112

13+
from azure.core.pipeline import policies
1214
from azure.core.rest import HttpRequest, HttpResponse
1315
from azure.mgmt.core import ARMPipelineClient
16+
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
1417

1518
from . import models as _models
1619
from ._configuration import DnsResolverManagementClientConfiguration
1720
from ._serialization import Deserializer, Serializer
1821
from .operations import (
1922
DnsForwardingRulesetsOperations,
23+
DnsResolverDomainListsOperations,
24+
DnsResolverPoliciesOperations,
25+
DnsResolverPolicyVirtualNetworkLinksOperations,
2026
DnsResolversOperations,
27+
DnsSecurityRulesOperations,
2128
ForwardingRulesOperations,
2229
InboundEndpointsOperations,
2330
OutboundEndpointsOperations,
@@ -29,8 +36,8 @@
2936
from azure.core.credentials import TokenCredential
3037

3138

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.
3441
3542
:ivar dns_resolvers: DnsResolversOperations operations
3643
:vartype dns_resolvers: azure.mgmt.dnsresolver.operations.DnsResolversOperations
@@ -45,14 +52,25 @@ class DnsResolverManagementClient: # pylint: disable=client-accepts-api-version
4552
:vartype forwarding_rules: azure.mgmt.dnsresolver.operations.ForwardingRulesOperations
4653
:ivar virtual_network_links: VirtualNetworkLinksOperations operations
4754
: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
4866
:param credential: Credential needed for the client to connect to Azure. Required.
4967
: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.
5169
:type subscription_id: str
5270
:param base_url: Service URL. Default value is "https://management.azure.com".
5371
: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.
5674
:paramtype api_version: str
5775
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
5876
Retry-After header is present.
@@ -68,7 +86,25 @@ def __init__(
6886
self._config = DnsResolverManagementClientConfiguration(
6987
credential=credential, subscription_id=subscription_id, **kwargs
7088
)
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)
72108

73109
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
74110
self._serialize = Serializer(client_models)
@@ -90,8 +126,20 @@ def __init__(
90126
self.virtual_network_links = VirtualNetworkLinksOperations(
91127
self._client, self._config, self._serialize, self._deserialize
92128
)
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+
)
93141

94-
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
142+
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
95143
"""Runs the network request through the client's chained policies.
96144
97145
>>> from azure.core.rest import HttpRequest
@@ -111,14 +159,14 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
111159

112160
request_copy = deepcopy(request)
113161
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
115163

116164
def close(self) -> None:
117165
self._client.close()
118166

119-
def __enter__(self) -> "DnsResolverManagementClient":
167+
def __enter__(self) -> Self:
120168
self._client.__enter__()
121169
return self
122170

123-
def __exit__(self, *exc_details) -> None:
171+
def __exit__(self, *exc_details: Any) -> None:
124172
self._client.__exit__(*exc_details)

sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/_patch.py

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#
2626
# --------------------------------------------------------------------------
2727

28+
2829
# This file is used for handwritten extensions to the generated code. Example:
2930
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
3031
def patch_sdk():

0 commit comments

Comments
 (0)