Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoRelease] t2-dnsresolver-2024-10-12-16936(can only be merged by SDK owner) #37864

Merged
merged 4 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions sdk/dnsresolver/azure-mgmt-dnsresolver/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
# Release History

## 1.1.0b2 (2024-XX-XX)

### Features Added

- Client `DnsResolverManagementClient` added operation group `dns_resolver_policies`
- Client `DnsResolverManagementClient` added operation group `dns_security_rules`
- Client `DnsResolverManagementClient` added operation group `dns_resolver_policy_virtual_network_links`
- Client `DnsResolverManagementClient` added operation group `dns_resolver_domain_lists`
- Model `Resource` added property `system_data`
- Added enum `ActionType`
- Added enum `BlockResponseCode`
- Added model `DnsResolverDomainList`
- Added model `DnsResolverDomainListPatch`
- Added model `DnsResolverDomainListResult`
- Added model `DnsResolverPolicy`
- Added model `DnsResolverPolicyListResult`
- Added model `DnsResolverPolicyPatch`
- Added model `DnsResolverPolicyVirtualNetworkLink`
- Added model `DnsResolverPolicyVirtualNetworkLinkListResult`
- Added model `DnsResolverPolicyVirtualNetworkLinkPatch`
- Added model `DnsSecurityRule`
- Added model `DnsSecurityRuleAction`
- Added model `DnsSecurityRuleListResult`
- Added model `DnsSecurityRulePatch`
- Added enum `DnsSecurityRuleState`
- Added model `ErrorAdditionalInfo`
- Added model `ErrorDetail`
- Added model `ErrorResponse`
- Added model `DnsResolverDomainListsOperations`
- Added model `DnsResolverPoliciesOperations`
- Added model `DnsResolverPolicyVirtualNetworkLinksOperations`
- Added model `DnsSecurityRulesOperations`

## 1.1.0b1 (2022-12-27)

### Other Changes
Expand Down
18 changes: 8 additions & 10 deletions sdk/dnsresolver/azure-mgmt-dnsresolver/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Microsoft Azure SDK for Python

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

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

### Prerequisites

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

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

- `AZURE_CLIENT_ID` for Azure client ID.
- `AZURE_TENANT_ID` for Azure tenant ID.
- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate.
- `AZURE_CLIENT_SECRET` for Azure client secret.

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

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

```python
from azure.identity import DefaultAzureCredential
from azure.mgmt.dnsresolver import DnsResolverManagementClient
from azure.mgmt.dnsresolver import DnsresolverManagementClient
import os

sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
client = DnsResolverManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
client = DnsresolverManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
```

## Examples


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)
Code samples for this package can be found at:
- [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
- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)


## Troubleshooting
Expand All @@ -58,6 +59,3 @@ Code samples for this package can be found at [Dnsresolver Management](https://d
If you encounter any bugs or have suggestions, please file an issue in the
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
section of the project.


![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-dnsresolver%2FREADME.png)
10 changes: 5 additions & 5 deletions sdk/dnsresolver/azure-mgmt-dnsresolver/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "89a9bf17524904e7670f0fd2d62ac882ca00d85c",
"commit": "15b16d1b5c3cccdecdd1cfe936f6a8005680c557",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"autorest": "3.10.2",
"use": [
"@autorest/python@6.2.7",
"@autorest/modelerfour@4.24.3"
"@autorest/python@6.19.0",
"@autorest/modelerfour@4.27.0"
],
"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",
"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",
"readme": "specification/dnsresolver/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,35 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

import sys
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy

from ._version import VERSION

if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential


class DnsResolverManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
class DnsResolverManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for DnsResolverManagementClient.

Note that all parameters used to create this instance are saved as instance
attributes.

:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. Required.
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2022-07-01". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2023-07-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

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

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

def _configure(self, **kwargs: Any) -> None:
Expand All @@ -62,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,23 @@

from copy import deepcopy
from typing import Any, TYPE_CHECKING
from typing_extensions import Self

from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy

from . import models as _models
from ._configuration import DnsResolverManagementClientConfiguration
from ._serialization import Deserializer, Serializer
from .operations import (
DnsForwardingRulesetsOperations,
DnsResolverDomainListsOperations,
DnsResolverPoliciesOperations,
DnsResolverPolicyVirtualNetworkLinksOperations,
DnsResolversOperations,
DnsSecurityRulesOperations,
ForwardingRulesOperations,
InboundEndpointsOperations,
OutboundEndpointsOperations,
Expand All @@ -29,8 +36,8 @@
from azure.core.credentials import TokenCredential


class DnsResolverManagementClient: # pylint: disable=client-accepts-api-version-keyword
"""The DNS Resolver Management Client.
class DnsResolverManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""DNS Resolver Client.

:ivar dns_resolvers: DnsResolversOperations operations
:vartype dns_resolvers: azure.mgmt.dnsresolver.operations.DnsResolversOperations
Expand All @@ -45,14 +52,25 @@ class DnsResolverManagementClient: # pylint: disable=client-accepts-api-version
:vartype forwarding_rules: azure.mgmt.dnsresolver.operations.ForwardingRulesOperations
:ivar virtual_network_links: VirtualNetworkLinksOperations operations
:vartype virtual_network_links: azure.mgmt.dnsresolver.operations.VirtualNetworkLinksOperations
:ivar dns_resolver_policies: DnsResolverPoliciesOperations operations
:vartype dns_resolver_policies: azure.mgmt.dnsresolver.operations.DnsResolverPoliciesOperations
:ivar dns_security_rules: DnsSecurityRulesOperations operations
:vartype dns_security_rules: azure.mgmt.dnsresolver.operations.DnsSecurityRulesOperations
:ivar dns_resolver_policy_virtual_network_links: DnsResolverPolicyVirtualNetworkLinksOperations
operations
:vartype dns_resolver_policy_virtual_network_links:
azure.mgmt.dnsresolver.operations.DnsResolverPolicyVirtualNetworkLinksOperations
:ivar dns_resolver_domain_lists: DnsResolverDomainListsOperations operations
:vartype dns_resolver_domain_lists:
azure.mgmt.dnsresolver.operations.DnsResolverDomainListsOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. Required.
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2022-07-01". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2023-07-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
Expand All @@ -68,7 +86,25 @@ def __init__(
self._config = DnsResolverManagementClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
_policies = kwargs.pop("policies", None)
if _policies is None:
_policies = [
policies.RequestIdPolicy(**kwargs),
self._config.headers_policy,
self._config.user_agent_policy,
self._config.proxy_policy,
policies.ContentDecodePolicy(**kwargs),
ARMAutoResourceProviderRegistrationPolicy(),
self._config.redirect_policy,
self._config.retry_policy,
self._config.authentication_policy,
self._config.custom_hook_policy,
self._config.logging_policy,
policies.DistributedTracingPolicy(**kwargs),
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
self._config.http_logging_policy,
]
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)

client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
Expand All @@ -90,8 +126,20 @@ def __init__(
self.virtual_network_links = VirtualNetworkLinksOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.dns_resolver_policies = DnsResolverPoliciesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.dns_security_rules = DnsSecurityRulesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.dns_resolver_policy_virtual_network_links = DnsResolverPolicyVirtualNetworkLinksOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.dns_resolver_domain_lists = DnsResolverDomainListsOperations(
self._client, self._config, self._serialize, self._deserialize
)

def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.

>>> from azure.core.rest import HttpRequest
Expand All @@ -111,14 +159,14 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:

request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore

def close(self) -> None:
self._client.close()

def __enter__(self) -> "DnsResolverManagementClient":
def __enter__(self) -> Self:
self._client.__enter__()
return self

def __exit__(self, *exc_details) -> None:
def __exit__(self, *exc_details: Any) -> None:
self._client.__exit__(*exc_details)
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#
# --------------------------------------------------------------------------


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