[AutoRelease] t2-dnsresolver-2024-10-12-16936(can only be merged by SDK owner) (#37864)
* code and test * update-testcase * Update CHANGELOG.md * Update CHANGELOG.md --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <v-chenjiang@microsoft.com> Co-authored-by: ChenxiJiang333 <119990644+ChenxiJiang333@users.noreply.github.com> Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com>
This commit is contained in:
Родитель
f77bd946b2
Коммит
1c666fcd40
|
@ -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
|
||||
|
|
|
@ -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_
|
||||
|
@ -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
|
||||
|
@ -28,7 +28,7 @@ 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`.
|
||||
|
||||
|
@ -36,17 +36,18 @@ 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
|
||||
|
@ -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)
|
||||
|
|
|
@ -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"
|
||||
}
|
|
@ -6,26 +6,19 @@
|
|||
# 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
|
||||
|
@ -33,16 +26,15 @@ class DnsResolverManagementClientConfiguration(Configuration): # pylint: disabl
|
|||
|
||||
: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.")
|
||||
|
@ -54,6 +46,7 @@ class DnsResolverManagementClientConfiguration(Configuration): # pylint: disabl
|
|||
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:
|
||||
|
@ -62,9 +55,9 @@ class DnsResolverManagementClientConfiguration(Configuration): # pylint: disabl
|
|||
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(
|
||||
|
|
|
@ -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,
|
||||
|
@ -29,8 +36,8 @@ if TYPE_CHECKING:
|
|||
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
|
||||
|
@ -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.
|
||||
|
@ -68,7 +86,25 @@ class DnsResolverManagementClient: # pylint: disable=client-accepts-api-version
|
|||
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)
|
||||
|
@ -90,8 +126,20 @@ class DnsResolverManagementClient: # pylint: disable=client-accepts-api-version
|
|||
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
|
||||
|
@ -111,14 +159,14 @@ class DnsResolverManagementClient: # pylint: disable=client-accepts-api-version
|
|||
|
||||
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)
|
||||
|
|
|
@ -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():
|
||||
|
|
|
@ -38,7 +38,22 @@ import logging
|
|||
import re
|
||||
import sys
|
||||
import codecs
|
||||
from typing import Optional, Union, AnyStr, IO, Mapping
|
||||
from typing import (
|
||||
Dict,
|
||||
Any,
|
||||
cast,
|
||||
Optional,
|
||||
Union,
|
||||
AnyStr,
|
||||
IO,
|
||||
Mapping,
|
||||
Callable,
|
||||
TypeVar,
|
||||
MutableMapping,
|
||||
Type,
|
||||
List,
|
||||
Mapping,
|
||||
)
|
||||
|
||||
try:
|
||||
from urllib import quote # type: ignore
|
||||
|
@ -48,12 +63,14 @@ import xml.etree.ElementTree as ET
|
|||
|
||||
import isodate # type: ignore
|
||||
|
||||
from typing import Dict, Any, cast
|
||||
|
||||
from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback
|
||||
from azure.core.exceptions import DeserializationError, SerializationError
|
||||
from azure.core.serialization import NULL as CoreNull
|
||||
|
||||
_BOM = codecs.BOM_UTF8.decode(encoding="utf-8")
|
||||
|
||||
ModelType = TypeVar("ModelType", bound="Model")
|
||||
JSON = MutableMapping[str, Any]
|
||||
|
||||
|
||||
class RawDeserializer:
|
||||
|
||||
|
@ -107,7 +124,7 @@ class RawDeserializer:
|
|||
pass
|
||||
|
||||
return ET.fromstring(data_as_str) # nosec
|
||||
except ET.ParseError:
|
||||
except ET.ParseError as err:
|
||||
# It might be because the server has an issue, and returned JSON with
|
||||
# content-type XML....
|
||||
# So let's try a JSON load, and if it's still broken
|
||||
|
@ -126,7 +143,9 @@ class RawDeserializer:
|
|||
# The function hack is because Py2.7 messes up with exception
|
||||
# context otherwise.
|
||||
_LOGGER.critical("Wasn't XML not JSON, failing")
|
||||
raise_with_traceback(DeserializationError, "XML is invalid")
|
||||
raise DeserializationError("XML is invalid") from err
|
||||
elif content_type.startswith("text/"):
|
||||
return data_as_str
|
||||
raise DeserializationError("Cannot deserialize content-type: {}".format(content_type))
|
||||
|
||||
@classmethod
|
||||
|
@ -153,13 +172,6 @@ class RawDeserializer:
|
|||
return None
|
||||
|
||||
|
||||
try:
|
||||
basestring # type: ignore
|
||||
unicode_str = unicode # type: ignore
|
||||
except NameError:
|
||||
basestring = str
|
||||
unicode_str = str
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
|
@ -277,8 +289,8 @@ class Model(object):
|
|||
_attribute_map: Dict[str, Dict[str, Any]] = {}
|
||||
_validation: Dict[str, Dict[str, Any]] = {}
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.additional_properties = {}
|
||||
def __init__(self, **kwargs: Any) -> None:
|
||||
self.additional_properties: Optional[Dict[str, Any]] = {}
|
||||
for k in kwargs:
|
||||
if k not in self._attribute_map:
|
||||
_LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__)
|
||||
|
@ -287,25 +299,25 @@ class Model(object):
|
|||
else:
|
||||
setattr(self, k, kwargs[k])
|
||||
|
||||
def __eq__(self, other):
|
||||
def __eq__(self, other: Any) -> bool:
|
||||
"""Compare objects by comparing all attributes."""
|
||||
if isinstance(other, self.__class__):
|
||||
return self.__dict__ == other.__dict__
|
||||
return False
|
||||
|
||||
def __ne__(self, other):
|
||||
def __ne__(self, other: Any) -> bool:
|
||||
"""Compare objects by comparing all attributes."""
|
||||
return not self.__eq__(other)
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return str(self.__dict__)
|
||||
|
||||
@classmethod
|
||||
def enable_additional_properties_sending(cls):
|
||||
def enable_additional_properties_sending(cls) -> None:
|
||||
cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"}
|
||||
|
||||
@classmethod
|
||||
def is_xml_model(cls):
|
||||
def is_xml_model(cls) -> bool:
|
||||
try:
|
||||
cls._xml_map # type: ignore
|
||||
except AttributeError:
|
||||
|
@ -322,8 +334,8 @@ class Model(object):
|
|||
|
||||
return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None))
|
||||
|
||||
def serialize(self, keep_readonly=False, **kwargs):
|
||||
"""Return the JSON that would be sent to azure from this model.
|
||||
def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON:
|
||||
"""Return the JSON that would be sent to server from this model.
|
||||
|
||||
This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`.
|
||||
|
||||
|
@ -334,10 +346,15 @@ class Model(object):
|
|||
:rtype: dict
|
||||
"""
|
||||
serializer = Serializer(self._infer_class_models())
|
||||
return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs)
|
||||
return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore
|
||||
|
||||
def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs):
|
||||
"""Return a dict that can be JSONify using json.dump.
|
||||
def as_dict(
|
||||
self,
|
||||
keep_readonly: bool = True,
|
||||
key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer,
|
||||
**kwargs: Any
|
||||
) -> JSON:
|
||||
"""Return a dict that can be serialized using json.dump.
|
||||
|
||||
Advanced usage might optionally use a callback as parameter:
|
||||
|
||||
|
@ -368,7 +385,7 @@ class Model(object):
|
|||
:rtype: dict
|
||||
"""
|
||||
serializer = Serializer(self._infer_class_models())
|
||||
return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs)
|
||||
return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore
|
||||
|
||||
@classmethod
|
||||
def _infer_class_models(cls):
|
||||
|
@ -384,7 +401,7 @@ class Model(object):
|
|||
return client_models
|
||||
|
||||
@classmethod
|
||||
def deserialize(cls, data, content_type=None):
|
||||
def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType:
|
||||
"""Parse a str using the RestAPI syntax and return a model.
|
||||
|
||||
:param str data: A str using RestAPI structure. JSON by default.
|
||||
|
@ -393,10 +410,15 @@ class Model(object):
|
|||
:raises: DeserializationError if something went wrong
|
||||
"""
|
||||
deserializer = Deserializer(cls._infer_class_models())
|
||||
return deserializer(cls.__name__, data, content_type=content_type)
|
||||
return deserializer(cls.__name__, data, content_type=content_type) # type: ignore
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, data, key_extractors=None, content_type=None):
|
||||
def from_dict(
|
||||
cls: Type[ModelType],
|
||||
data: Any,
|
||||
key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None,
|
||||
content_type: Optional[str] = None,
|
||||
) -> ModelType:
|
||||
"""Parse a dict using given key extractor return a model.
|
||||
|
||||
By default consider key
|
||||
|
@ -409,8 +431,8 @@ class Model(object):
|
|||
:raises: DeserializationError if something went wrong
|
||||
"""
|
||||
deserializer = Deserializer(cls._infer_class_models())
|
||||
deserializer.key_extractors = (
|
||||
[
|
||||
deserializer.key_extractors = ( # type: ignore
|
||||
[ # type: ignore
|
||||
attribute_key_case_insensitive_extractor,
|
||||
rest_key_case_insensitive_extractor,
|
||||
last_rest_key_case_insensitive_extractor,
|
||||
|
@ -418,7 +440,7 @@ class Model(object):
|
|||
if key_extractors is None
|
||||
else key_extractors
|
||||
)
|
||||
return deserializer(cls.__name__, data, content_type=content_type)
|
||||
return deserializer(cls.__name__, data, content_type=content_type) # type: ignore
|
||||
|
||||
@classmethod
|
||||
def _flatten_subtype(cls, key, objects):
|
||||
|
@ -518,7 +540,7 @@ class Serializer(object):
|
|||
"multiple": lambda x, y: x % y != 0,
|
||||
}
|
||||
|
||||
def __init__(self, classes=None):
|
||||
def __init__(self, classes: Optional[Mapping[str, type]] = None):
|
||||
self.serialize_type = {
|
||||
"iso-8601": Serializer.serialize_iso,
|
||||
"rfc-1123": Serializer.serialize_rfc,
|
||||
|
@ -534,7 +556,7 @@ class Serializer(object):
|
|||
"[]": self.serialize_iter,
|
||||
"{}": self.serialize_dict,
|
||||
}
|
||||
self.dependencies = dict(classes) if classes else {}
|
||||
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
|
||||
self.key_transformer = full_restapi_key_transformer
|
||||
self.client_side_validation = True
|
||||
|
||||
|
@ -602,7 +624,7 @@ class Serializer(object):
|
|||
if xml_desc.get("attr", False):
|
||||
if xml_ns:
|
||||
ET.register_namespace(xml_prefix, xml_ns)
|
||||
xml_name = "{}{}".format(xml_ns, xml_name)
|
||||
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
|
||||
serialized.set(xml_name, new_attr) # type: ignore
|
||||
continue
|
||||
if xml_desc.get("text", False):
|
||||
|
@ -622,12 +644,11 @@ class Serializer(object):
|
|||
else: # That's a basic type
|
||||
# Integrate namespace if necessary
|
||||
local_node = _create_xml_node(xml_name, xml_prefix, xml_ns)
|
||||
local_node.text = unicode_str(new_attr)
|
||||
local_node.text = str(new_attr)
|
||||
serialized.append(local_node) # type: ignore
|
||||
else: # JSON
|
||||
for k in reversed(keys): # type: ignore
|
||||
unflattened = {k: new_attr}
|
||||
new_attr = unflattened
|
||||
new_attr = {k: new_attr}
|
||||
|
||||
_new_attr = new_attr
|
||||
_serialized = serialized
|
||||
|
@ -636,12 +657,13 @@ class Serializer(object):
|
|||
_serialized.update(_new_attr) # type: ignore
|
||||
_new_attr = _new_attr[k] # type: ignore
|
||||
_serialized = _serialized[k]
|
||||
except ValueError:
|
||||
continue
|
||||
except ValueError as err:
|
||||
if isinstance(err, SerializationError):
|
||||
raise
|
||||
|
||||
except (AttributeError, KeyError, TypeError) as err:
|
||||
msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj))
|
||||
raise_with_traceback(SerializationError, msg, err)
|
||||
raise SerializationError(msg) from err
|
||||
else:
|
||||
return serialized
|
||||
|
||||
|
@ -656,8 +678,8 @@ class Serializer(object):
|
|||
"""
|
||||
|
||||
# Just in case this is a dict
|
||||
internal_data_type = data_type.strip("[]{}")
|
||||
internal_data_type = self.dependencies.get(internal_data_type, None)
|
||||
internal_data_type_str = data_type.strip("[]{}")
|
||||
internal_data_type = self.dependencies.get(internal_data_type_str, None)
|
||||
try:
|
||||
is_xml_model_serialization = kwargs["is_xml"]
|
||||
except KeyError:
|
||||
|
@ -683,7 +705,7 @@ class Serializer(object):
|
|||
]
|
||||
data = deserializer._deserialize(data_type, data)
|
||||
except DeserializationError as err:
|
||||
raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err)
|
||||
raise SerializationError("Unable to build a model: " + str(err)) from err
|
||||
|
||||
return self._serialize(data, data_type, **kwargs)
|
||||
|
||||
|
@ -703,6 +725,7 @@ class Serializer(object):
|
|||
|
||||
if kwargs.get("skip_quote") is True:
|
||||
output = str(output)
|
||||
output = output.replace("{", quote("{")).replace("}", quote("}"))
|
||||
else:
|
||||
output = quote(str(output), safe="")
|
||||
except SerializationError:
|
||||
|
@ -715,7 +738,9 @@ class Serializer(object):
|
|||
|
||||
:param data: The data to be serialized.
|
||||
:param str data_type: The type to be serialized from.
|
||||
:rtype: str
|
||||
:keyword bool skip_quote: Whether to skip quote the serialized result.
|
||||
Defaults to False.
|
||||
:rtype: str, list
|
||||
:raises: TypeError if serialization fails.
|
||||
:raises: ValueError if data is None
|
||||
"""
|
||||
|
@ -723,10 +748,8 @@ class Serializer(object):
|
|||
# Treat the list aside, since we don't want to encode the div separator
|
||||
if data_type.startswith("["):
|
||||
internal_data_type = data_type[1:-1]
|
||||
data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data]
|
||||
if not kwargs.get("skip_quote", False):
|
||||
data = [quote(str(d), safe="") for d in data]
|
||||
return str(self.serialize_iter(data, internal_data_type, **kwargs))
|
||||
do_quote = not kwargs.get("skip_quote", False)
|
||||
return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)
|
||||
|
||||
# Not a list, regular serialization
|
||||
output = self.serialize_data(data, data_type, **kwargs)
|
||||
|
@ -777,6 +800,8 @@ class Serializer(object):
|
|||
raise ValueError("No value for given attribute")
|
||||
|
||||
try:
|
||||
if data is CoreNull:
|
||||
return None
|
||||
if data_type in self.basic_types.values():
|
||||
return self.serialize_basic(data, data_type, **kwargs)
|
||||
|
||||
|
@ -795,7 +820,7 @@ class Serializer(object):
|
|||
|
||||
except (ValueError, TypeError) as err:
|
||||
msg = "Unable to serialize value: {!r} as type: {!r}."
|
||||
raise_with_traceback(SerializationError, msg.format(data, data_type), err)
|
||||
raise SerializationError(msg.format(data, data_type)) from err
|
||||
else:
|
||||
return self._serialize(data, **kwargs)
|
||||
|
||||
|
@ -863,6 +888,8 @@ class Serializer(object):
|
|||
not be None or empty.
|
||||
:param str div: If set, this str will be used to combine the elements
|
||||
in the iterable into a combined string. Default is 'None'.
|
||||
:keyword bool do_quote: Whether to quote the serialized result of each iterable element.
|
||||
Defaults to False.
|
||||
:rtype: list, str
|
||||
"""
|
||||
if isinstance(data, str):
|
||||
|
@ -875,9 +902,14 @@ class Serializer(object):
|
|||
for d in data:
|
||||
try:
|
||||
serialized.append(self.serialize_data(d, iter_type, **kwargs))
|
||||
except ValueError:
|
||||
except ValueError as err:
|
||||
if isinstance(err, SerializationError):
|
||||
raise
|
||||
serialized.append(None)
|
||||
|
||||
if kwargs.get("do_quote", False):
|
||||
serialized = ["" if s is None else quote(str(s), safe="") for s in serialized]
|
||||
|
||||
if div:
|
||||
serialized = ["" if s is None else str(s) for s in serialized]
|
||||
serialized = div.join(serialized)
|
||||
|
@ -922,7 +954,9 @@ class Serializer(object):
|
|||
for key, value in attr.items():
|
||||
try:
|
||||
serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs)
|
||||
except ValueError:
|
||||
except ValueError as err:
|
||||
if isinstance(err, SerializationError):
|
||||
raise
|
||||
serialized[self.serialize_unicode(key)] = None
|
||||
|
||||
if "xml" in serialization_ctxt:
|
||||
|
@ -955,7 +989,7 @@ class Serializer(object):
|
|||
return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs)
|
||||
if obj_type is _long_type:
|
||||
return self.serialize_long(attr)
|
||||
if obj_type is unicode_str:
|
||||
if obj_type is str:
|
||||
return self.serialize_unicode(attr)
|
||||
if obj_type is datetime.datetime:
|
||||
return self.serialize_iso(attr)
|
||||
|
@ -1132,10 +1166,10 @@ class Serializer(object):
|
|||
return date + microseconds + "Z"
|
||||
except (ValueError, OverflowError) as err:
|
||||
msg = "Unable to serialize datetime object."
|
||||
raise_with_traceback(SerializationError, msg, err)
|
||||
raise SerializationError(msg) from err
|
||||
except AttributeError as err:
|
||||
msg = "ISO-8601 object must be valid Datetime object."
|
||||
raise_with_traceback(TypeError, msg, err)
|
||||
raise TypeError(msg) from err
|
||||
|
||||
@staticmethod
|
||||
def serialize_unix(attr, **kwargs):
|
||||
|
@ -1161,7 +1195,8 @@ def rest_key_extractor(attr, attr_desc, data):
|
|||
working_data = data
|
||||
|
||||
while "." in key:
|
||||
dict_keys = _FLATTEN.split(key)
|
||||
# Need the cast, as for some reasons "split" is typed as list[str | Any]
|
||||
dict_keys = cast(List[str], _FLATTEN.split(key))
|
||||
if len(dict_keys) == 1:
|
||||
key = _decode_attribute_map_key(dict_keys[0])
|
||||
break
|
||||
|
@ -1170,7 +1205,6 @@ def rest_key_extractor(attr, attr_desc, data):
|
|||
if working_data is None:
|
||||
# If at any point while following flatten JSON path see None, it means
|
||||
# that all properties under are None as well
|
||||
# https://github.com/Azure/msrest-for-python/issues/197
|
||||
return None
|
||||
key = ".".join(dict_keys[1:])
|
||||
|
||||
|
@ -1191,7 +1225,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data):
|
|||
if working_data is None:
|
||||
# If at any point while following flatten JSON path see None, it means
|
||||
# that all properties under are None as well
|
||||
# https://github.com/Azure/msrest-for-python/issues/197
|
||||
return None
|
||||
key = ".".join(dict_keys[1:])
|
||||
|
||||
|
@ -1242,7 +1275,7 @@ def _extract_name_from_internal_type(internal_type):
|
|||
xml_name = internal_type_xml_map.get("name", internal_type.__name__)
|
||||
xml_ns = internal_type_xml_map.get("ns", None)
|
||||
if xml_ns:
|
||||
xml_name = "{}{}".format(xml_ns, xml_name)
|
||||
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
|
||||
return xml_name
|
||||
|
||||
|
||||
|
@ -1266,7 +1299,7 @@ def xml_key_extractor(attr, attr_desc, data):
|
|||
# Integrate namespace if necessary
|
||||
xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None))
|
||||
if xml_ns:
|
||||
xml_name = "{}{}".format(xml_ns, xml_name)
|
||||
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
|
||||
|
||||
# If it's an attribute, that's simple
|
||||
if xml_desc.get("attr", False):
|
||||
|
@ -1332,7 +1365,7 @@ class Deserializer(object):
|
|||
|
||||
valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?")
|
||||
|
||||
def __init__(self, classes=None):
|
||||
def __init__(self, classes: Optional[Mapping[str, type]] = None):
|
||||
self.deserialize_type = {
|
||||
"iso-8601": Deserializer.deserialize_iso,
|
||||
"rfc-1123": Deserializer.deserialize_rfc,
|
||||
|
@ -1352,7 +1385,7 @@ class Deserializer(object):
|
|||
"duration": (isodate.Duration, datetime.timedelta),
|
||||
"iso-8601": (datetime.datetime),
|
||||
}
|
||||
self.dependencies = dict(classes) if classes else {}
|
||||
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
|
||||
self.key_extractors = [rest_key_extractor, xml_key_extractor]
|
||||
# Additional properties only works if the "rest_key_extractor" is used to
|
||||
# extract the keys. Making it to work whatever the key extractor is too much
|
||||
|
@ -1405,12 +1438,12 @@ class Deserializer(object):
|
|||
|
||||
response, class_name = self._classify_target(target_obj, data)
|
||||
|
||||
if isinstance(response, basestring):
|
||||
if isinstance(response, str):
|
||||
return self.deserialize_data(data, response)
|
||||
elif isinstance(response, type) and issubclass(response, Enum):
|
||||
return self.deserialize_enum(data, response)
|
||||
|
||||
if data is None:
|
||||
if data is None or data is CoreNull:
|
||||
return data
|
||||
try:
|
||||
attributes = response._attribute_map # type: ignore
|
||||
|
@ -1442,7 +1475,7 @@ class Deserializer(object):
|
|||
d_attrs[attr] = value
|
||||
except (AttributeError, TypeError, KeyError) as err:
|
||||
msg = "Unable to deserialize to object: " + class_name # type: ignore
|
||||
raise_with_traceback(DeserializationError, msg, err)
|
||||
raise DeserializationError(msg) from err
|
||||
else:
|
||||
additional_properties = self._build_additional_properties(attributes, data)
|
||||
return self._instantiate_model(response, d_attrs, additional_properties)
|
||||
|
@ -1471,22 +1504,22 @@ class Deserializer(object):
|
|||
Once classification has been determined, initialize object.
|
||||
|
||||
:param str target: The target object type to deserialize to.
|
||||
:param str/dict data: The response data to deseralize.
|
||||
:param str/dict data: The response data to deserialize.
|
||||
"""
|
||||
if target is None:
|
||||
return None, None
|
||||
|
||||
if isinstance(target, basestring):
|
||||
if isinstance(target, str):
|
||||
try:
|
||||
target = self.dependencies[target]
|
||||
except KeyError:
|
||||
return target, target
|
||||
|
||||
try:
|
||||
target = target._classify(data, self.dependencies)
|
||||
target = target._classify(data, self.dependencies) # type: ignore
|
||||
except AttributeError:
|
||||
pass # Target is not a Model, no classify
|
||||
return target, target.__class__.__name__
|
||||
return target, target.__class__.__name__ # type: ignore
|
||||
|
||||
def failsafe_deserialize(self, target_obj, data, content_type=None):
|
||||
"""Ignores any errors encountered in deserialization,
|
||||
|
@ -1496,7 +1529,7 @@ class Deserializer(object):
|
|||
a deserialization error.
|
||||
|
||||
:param str target_obj: The target object type to deserialize to.
|
||||
:param str/dict data: The response data to deseralize.
|
||||
:param str/dict data: The response data to deserialize.
|
||||
:param str content_type: Swagger "produces" if available.
|
||||
"""
|
||||
try:
|
||||
|
@ -1539,7 +1572,7 @@ class Deserializer(object):
|
|||
if hasattr(raw_data, "_content_consumed"):
|
||||
return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers)
|
||||
|
||||
if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"):
|
||||
if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"):
|
||||
return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore
|
||||
return raw_data
|
||||
|
||||
|
@ -1613,7 +1646,7 @@ class Deserializer(object):
|
|||
except (ValueError, TypeError, AttributeError) as err:
|
||||
msg = "Unable to deserialize response data."
|
||||
msg += " Data: {}, {}".format(data, data_type)
|
||||
raise_with_traceback(DeserializationError, msg, err)
|
||||
raise DeserializationError(msg) from err
|
||||
else:
|
||||
return self._deserialize(obj_type, data)
|
||||
|
||||
|
@ -1661,7 +1694,7 @@ class Deserializer(object):
|
|||
if isinstance(attr, ET.Element):
|
||||
# Do no recurse on XML, just return the tree as-is
|
||||
return attr
|
||||
if isinstance(attr, basestring):
|
||||
if isinstance(attr, str):
|
||||
return self.deserialize_basic(attr, "str")
|
||||
obj_type = type(attr)
|
||||
if obj_type in self.basic_types:
|
||||
|
@ -1718,7 +1751,7 @@ class Deserializer(object):
|
|||
if data_type == "bool":
|
||||
if attr in [True, False, 1, 0]:
|
||||
return bool(attr)
|
||||
elif isinstance(attr, basestring):
|
||||
elif isinstance(attr, str):
|
||||
if attr.lower() in ["true", "1"]:
|
||||
return True
|
||||
elif attr.lower() in ["false", "0"]:
|
||||
|
@ -1769,7 +1802,6 @@ class Deserializer(object):
|
|||
data = data.value
|
||||
if isinstance(data, int):
|
||||
# Workaround. We might consider remove it in the future.
|
||||
# https://github.com/Azure/azure-rest-api-specs/issues/141
|
||||
try:
|
||||
return list(enum_obj.__members__.values())[data]
|
||||
except IndexError:
|
||||
|
@ -1823,10 +1855,10 @@ class Deserializer(object):
|
|||
if isinstance(attr, ET.Element):
|
||||
attr = attr.text
|
||||
try:
|
||||
return decimal.Decimal(attr) # type: ignore
|
||||
return decimal.Decimal(str(attr)) # type: ignore
|
||||
except decimal.DecimalException as err:
|
||||
msg = "Invalid decimal {}".format(attr)
|
||||
raise_with_traceback(DeserializationError, msg, err)
|
||||
raise DeserializationError(msg) from err
|
||||
|
||||
@staticmethod
|
||||
def deserialize_long(attr):
|
||||
|
@ -1854,7 +1886,7 @@ class Deserializer(object):
|
|||
duration = isodate.parse_duration(attr)
|
||||
except (ValueError, OverflowError, AttributeError) as err:
|
||||
msg = "Cannot deserialize duration object."
|
||||
raise_with_traceback(DeserializationError, msg, err)
|
||||
raise DeserializationError(msg) from err
|
||||
else:
|
||||
return duration
|
||||
|
||||
|
@ -1871,7 +1903,7 @@ class Deserializer(object):
|
|||
if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore
|
||||
raise DeserializationError("Date must have only digits and -. Received: %s" % attr)
|
||||
# This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception.
|
||||
return isodate.parse_date(attr, defaultmonth=None, defaultday=None)
|
||||
return isodate.parse_date(attr, defaultmonth=0, defaultday=0)
|
||||
|
||||
@staticmethod
|
||||
def deserialize_time(attr):
|
||||
|
@ -1906,7 +1938,7 @@ class Deserializer(object):
|
|||
date_obj = date_obj.astimezone(tz=TZ_UTC)
|
||||
except ValueError as err:
|
||||
msg = "Cannot deserialize to rfc datetime object."
|
||||
raise_with_traceback(DeserializationError, msg, err)
|
||||
raise DeserializationError(msg) from err
|
||||
else:
|
||||
return date_obj
|
||||
|
||||
|
@ -1943,7 +1975,7 @@ class Deserializer(object):
|
|||
raise OverflowError("Hit max or min date")
|
||||
except (ValueError, OverflowError, AttributeError) as err:
|
||||
msg = "Cannot deserialize datetime object."
|
||||
raise_with_traceback(DeserializationError, msg, err)
|
||||
raise DeserializationError(msg) from err
|
||||
else:
|
||||
return date_obj
|
||||
|
||||
|
@ -1959,9 +1991,10 @@ class Deserializer(object):
|
|||
if isinstance(attr, ET.Element):
|
||||
attr = int(attr.text) # type: ignore
|
||||
try:
|
||||
attr = int(attr)
|
||||
date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC)
|
||||
except ValueError as err:
|
||||
msg = "Cannot deserialize to unix datetime object."
|
||||
raise_with_traceback(DeserializationError, msg, err)
|
||||
raise DeserializationError(msg) from err
|
||||
else:
|
||||
return date_obj
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.core.pipeline.transport import HttpRequest
|
||||
|
||||
|
||||
def _convert_request(request, files=None):
|
||||
data = request.content if not files else None
|
||||
request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
|
||||
if files:
|
||||
request.set_formdata_body(files)
|
||||
return request
|
||||
|
||||
|
||||
def _format_url_section(template, **kwargs):
|
||||
components = template.split("/")
|
||||
while components:
|
||||
try:
|
||||
return template.format(**kwargs)
|
||||
except KeyError as key:
|
||||
formatted_components = template.split("/")
|
||||
components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
|
||||
template = "/".join(components)
|
|
@ -6,4 +6,4 @@
|
|||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
VERSION = "1.1.0b1"
|
||||
VERSION = "1.1.0b2"
|
||||
|
|
|
@ -6,26 +6,19 @@
|
|||
# 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 ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
|
||||
|
||||
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_async import AsyncTokenCredential
|
||||
|
||||
|
||||
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
|
||||
|
@ -33,16 +26,15 @@ class DnsResolverManagementClientConfiguration(Configuration): # pylint: disabl
|
|||
|
||||
:param credential: Credential needed for the client to connect to Azure. Required.
|
||||
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
|
||||
: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: "AsyncTokenCredential", 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.")
|
||||
|
@ -54,6 +46,7 @@ class DnsResolverManagementClientConfiguration(Configuration): # pylint: disabl
|
|||
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:
|
||||
|
@ -62,9 +55,9 @@ class DnsResolverManagementClientConfiguration(Configuration): # pylint: disabl
|
|||
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.AsyncRetryPolicy(**kwargs)
|
||||
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
|
||||
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
|
||||
self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
|
||||
self.authentication_policy = kwargs.get("authentication_policy")
|
||||
if self.credential and not self.authentication_policy:
|
||||
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
|
||||
|
|
|
@ -8,16 +8,23 @@
|
|||
|
||||
from copy import deepcopy
|
||||
from typing import Any, Awaitable, TYPE_CHECKING
|
||||
from typing_extensions import Self
|
||||
|
||||
from azure.core.pipeline import policies
|
||||
from azure.core.rest import AsyncHttpResponse, HttpRequest
|
||||
from azure.mgmt.core import AsyncARMPipelineClient
|
||||
from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
|
||||
|
||||
from .. import models as _models
|
||||
from .._serialization import Deserializer, Serializer
|
||||
from ._configuration import DnsResolverManagementClientConfiguration
|
||||
from .operations import (
|
||||
DnsForwardingRulesetsOperations,
|
||||
DnsResolverDomainListsOperations,
|
||||
DnsResolverPoliciesOperations,
|
||||
DnsResolverPolicyVirtualNetworkLinksOperations,
|
||||
DnsResolversOperations,
|
||||
DnsSecurityRulesOperations,
|
||||
ForwardingRulesOperations,
|
||||
InboundEndpointsOperations,
|
||||
OutboundEndpointsOperations,
|
||||
|
@ -29,8 +36,8 @@ if TYPE_CHECKING:
|
|||
from azure.core.credentials_async import AsyncTokenCredential
|
||||
|
||||
|
||||
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.aio.operations.DnsResolversOperations
|
||||
|
@ -46,14 +53,26 @@ class DnsResolverManagementClient: # pylint: disable=client-accepts-api-version
|
|||
:ivar virtual_network_links: VirtualNetworkLinksOperations operations
|
||||
:vartype virtual_network_links:
|
||||
azure.mgmt.dnsresolver.aio.operations.VirtualNetworkLinksOperations
|
||||
:ivar dns_resolver_policies: DnsResolverPoliciesOperations operations
|
||||
:vartype dns_resolver_policies:
|
||||
azure.mgmt.dnsresolver.aio.operations.DnsResolverPoliciesOperations
|
||||
:ivar dns_security_rules: DnsSecurityRulesOperations operations
|
||||
:vartype dns_security_rules: azure.mgmt.dnsresolver.aio.operations.DnsSecurityRulesOperations
|
||||
:ivar dns_resolver_policy_virtual_network_links: DnsResolverPolicyVirtualNetworkLinksOperations
|
||||
operations
|
||||
:vartype dns_resolver_policy_virtual_network_links:
|
||||
azure.mgmt.dnsresolver.aio.operations.DnsResolverPolicyVirtualNetworkLinksOperations
|
||||
:ivar dns_resolver_domain_lists: DnsResolverDomainListsOperations operations
|
||||
:vartype dns_resolver_domain_lists:
|
||||
azure.mgmt.dnsresolver.aio.operations.DnsResolverDomainListsOperations
|
||||
:param credential: Credential needed for the client to connect to Azure. Required.
|
||||
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
|
||||
: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.
|
||||
|
@ -69,7 +88,25 @@ class DnsResolverManagementClient: # pylint: disable=client-accepts-api-version
|
|||
self._config = DnsResolverManagementClientConfiguration(
|
||||
credential=credential, subscription_id=subscription_id, **kwargs
|
||||
)
|
||||
self._client = AsyncARMPipelineClient(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),
|
||||
AsyncARMAutoResourceProviderRegistrationPolicy(),
|
||||
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: AsyncARMPipelineClient = AsyncARMPipelineClient(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)
|
||||
|
@ -91,8 +128,22 @@ class DnsResolverManagementClient: # pylint: disable=client-accepts-api-version
|
|||
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) -> Awaitable[AsyncHttpResponse]:
|
||||
def _send_request(
|
||||
self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
|
||||
) -> Awaitable[AsyncHttpResponse]:
|
||||
"""Runs the network request through the client's chained policies.
|
||||
|
||||
>>> from azure.core.rest import HttpRequest
|
||||
|
@ -112,14 +163,14 @@ class DnsResolverManagementClient: # pylint: disable=client-accepts-api-version
|
|||
|
||||
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
|
||||
|
||||
async def close(self) -> None:
|
||||
await self._client.close()
|
||||
|
||||
async def __aenter__(self) -> "DnsResolverManagementClient":
|
||||
async def __aenter__(self) -> Self:
|
||||
await self._client.__aenter__()
|
||||
return self
|
||||
|
||||
async def __aexit__(self, *exc_details) -> None:
|
||||
async def __aexit__(self, *exc_details: Any) -> None:
|
||||
await self._client.__aexit__(*exc_details)
|
||||
|
|
|
@ -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():
|
||||
|
|
|
@ -12,6 +12,10 @@ from ._outbound_endpoints_operations import OutboundEndpointsOperations
|
|||
from ._dns_forwarding_rulesets_operations import DnsForwardingRulesetsOperations
|
||||
from ._forwarding_rules_operations import ForwardingRulesOperations
|
||||
from ._virtual_network_links_operations import VirtualNetworkLinksOperations
|
||||
from ._dns_resolver_policies_operations import DnsResolverPoliciesOperations
|
||||
from ._dns_security_rules_operations import DnsSecurityRulesOperations
|
||||
from ._dns_resolver_policy_virtual_network_links_operations import DnsResolverPolicyVirtualNetworkLinksOperations
|
||||
from ._dns_resolver_domain_lists_operations import DnsResolverDomainListsOperations
|
||||
|
||||
from ._patch import __all__ as _patch_all
|
||||
from ._patch import * # pylint: disable=unused-wildcard-import
|
||||
|
@ -24,6 +28,10 @@ __all__ = [
|
|||
"DnsForwardingRulesetsOperations",
|
||||
"ForwardingRulesOperations",
|
||||
"VirtualNetworkLinksOperations",
|
||||
"DnsResolverPoliciesOperations",
|
||||
"DnsSecurityRulesOperations",
|
||||
"DnsResolverPolicyVirtualNetworkLinksOperations",
|
||||
"DnsResolverDomainListsOperations",
|
||||
]
|
||||
__all__.extend([p for p in _patch_all if p not in __all__])
|
||||
_patch_sdk()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# pylint: disable=too-many-lines
|
||||
# pylint: disable=too-many-lines,too-many-statements
|
||||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
@ -6,8 +6,9 @@
|
|||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
from io import IOBase
|
||||
import sys
|
||||
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
|
||||
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
|
||||
import urllib.parse
|
||||
|
||||
from azure.core.async_paging import AsyncItemPaged, AsyncList
|
||||
|
@ -17,12 +18,13 @@ from azure.core.exceptions import (
|
|||
ResourceExistsError,
|
||||
ResourceNotFoundError,
|
||||
ResourceNotModifiedError,
|
||||
StreamClosedError,
|
||||
StreamConsumedError,
|
||||
map_error,
|
||||
)
|
||||
from azure.core.pipeline import PipelineResponse
|
||||
from azure.core.pipeline.transport import AsyncHttpResponse
|
||||
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
|
||||
from azure.core.rest import HttpRequest
|
||||
from azure.core.rest import AsyncHttpResponse, HttpRequest
|
||||
from azure.core.tracing.decorator import distributed_trace
|
||||
from azure.core.tracing.decorator_async import distributed_trace_async
|
||||
from azure.core.utils import case_insensitive_dict
|
||||
|
@ -30,7 +32,6 @@ from azure.mgmt.core.exceptions import ARMErrorFormat
|
|||
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
|
||||
|
||||
from ... import models as _models
|
||||
from ..._vendor import _convert_request
|
||||
from ...operations._dns_forwarding_rulesets_operations import (
|
||||
build_create_or_update_request,
|
||||
build_delete_request,
|
||||
|
@ -41,10 +42,10 @@ from ...operations._dns_forwarding_rulesets_operations import (
|
|||
build_update_request,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
|
||||
if sys.version_info >= (3, 9):
|
||||
from collections.abc import MutableMapping
|
||||
else:
|
||||
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
|
||||
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
|
||||
T = TypeVar("T")
|
||||
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
|
||||
|
||||
|
@ -72,12 +73,12 @@ class DnsForwardingRulesetsOperations:
|
|||
self,
|
||||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
parameters: Union[_models.DnsForwardingRuleset, IO],
|
||||
parameters: Union[_models.DnsForwardingRuleset, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> Optional[_models.DnsForwardingRuleset]:
|
||||
error_map = {
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -88,21 +89,19 @@ class DnsForwardingRulesetsOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[Optional[_models.DnsForwardingRuleset]] = kwargs.pop("cls", None)
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IO, bytes)):
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "DnsForwardingRuleset")
|
||||
|
||||
request = build_create_or_update_request(
|
||||
_request = build_create_or_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
|
@ -112,38 +111,33 @@ class DnsForwardingRulesetsOperations:
|
|||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
template_url=self._create_or_update_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 201, 202]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = None
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize("DnsForwardingRuleset", pipeline_response)
|
||||
|
||||
if response.status_code == 201:
|
||||
deserialized = self._deserialize("DnsForwardingRuleset", pipeline_response)
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
_create_or_update_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
async def begin_create_or_update(
|
||||
|
@ -176,14 +170,6 @@ class DnsForwardingRulesetsOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either DnsForwardingRuleset or the result
|
||||
of cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsForwardingRuleset]
|
||||
|
@ -195,7 +181,7 @@ class DnsForwardingRulesetsOperations:
|
|||
self,
|
||||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
parameters: IO,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
*,
|
||||
|
@ -210,7 +196,7 @@ class DnsForwardingRulesetsOperations:
|
|||
:param dns_forwarding_ruleset_name: The name of the DNS forwarding ruleset. Required.
|
||||
:type dns_forwarding_ruleset_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Required.
|
||||
:type parameters: IO
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -221,14 +207,6 @@ class DnsForwardingRulesetsOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either DnsForwardingRuleset or the result
|
||||
of cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsForwardingRuleset]
|
||||
|
@ -240,7 +218,7 @@ class DnsForwardingRulesetsOperations:
|
|||
self,
|
||||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
parameters: Union[_models.DnsForwardingRuleset, IO],
|
||||
parameters: Union[_models.DnsForwardingRuleset, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
|
@ -252,9 +230,9 @@ class DnsForwardingRulesetsOperations:
|
|||
:type resource_group_name: str
|
||||
:param dns_forwarding_ruleset_name: The name of the DNS forwarding ruleset. Required.
|
||||
:type dns_forwarding_ruleset_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a model type
|
||||
or a IO type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsForwardingRuleset or IO
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a
|
||||
DnsForwardingRuleset type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsForwardingRuleset or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -262,17 +240,6 @@ class DnsForwardingRulesetsOperations:
|
|||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either DnsForwardingRuleset or the result
|
||||
of cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsForwardingRuleset]
|
||||
|
@ -281,9 +248,7 @@ class DnsForwardingRulesetsOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.DnsForwardingRuleset] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
|
@ -303,12 +268,13 @@ class DnsForwardingRulesetsOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("DnsForwardingRuleset", pipeline_response)
|
||||
deserialized = self._deserialize("DnsForwardingRuleset", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
|
@ -318,27 +284,25 @@ class DnsForwardingRulesetsOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller.from_continuation_token(
|
||||
return AsyncLROPoller[_models.DnsForwardingRuleset].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
begin_create_or_update.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"
|
||||
}
|
||||
return AsyncLROPoller[_models.DnsForwardingRuleset](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
async def _update_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
parameters: Union[_models.DnsForwardingRulesetPatch, IO],
|
||||
parameters: Union[_models.DnsForwardingRulesetPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> Optional[_models.DnsForwardingRuleset]:
|
||||
error_map = {
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -349,21 +313,19 @@ class DnsForwardingRulesetsOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[Optional[_models.DnsForwardingRuleset]] = kwargs.pop("cls", None)
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IO, bytes)):
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "DnsForwardingRulesetPatch")
|
||||
|
||||
request = build_update_request(
|
||||
_request = build_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
|
@ -372,35 +334,33 @@ class DnsForwardingRulesetsOperations:
|
|||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
template_url=self._update_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 202]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = None
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize("DnsForwardingRuleset", pipeline_response)
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
_update_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
async def begin_update(
|
||||
|
@ -429,14 +389,6 @@ class DnsForwardingRulesetsOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either DnsForwardingRuleset or the result
|
||||
of cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsForwardingRuleset]
|
||||
|
@ -448,7 +400,7 @@ class DnsForwardingRulesetsOperations:
|
|||
self,
|
||||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
parameters: IO,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
|
@ -462,7 +414,7 @@ class DnsForwardingRulesetsOperations:
|
|||
:param dns_forwarding_ruleset_name: The name of the DNS forwarding ruleset. Required.
|
||||
:type dns_forwarding_ruleset_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Required.
|
||||
:type parameters: IO
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -470,14 +422,6 @@ class DnsForwardingRulesetsOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either DnsForwardingRuleset or the result
|
||||
of cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsForwardingRuleset]
|
||||
|
@ -489,7 +433,7 @@ class DnsForwardingRulesetsOperations:
|
|||
self,
|
||||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
parameters: Union[_models.DnsForwardingRulesetPatch, IO],
|
||||
parameters: Union[_models.DnsForwardingRulesetPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsForwardingRuleset]:
|
||||
|
@ -500,24 +444,13 @@ class DnsForwardingRulesetsOperations:
|
|||
:type resource_group_name: str
|
||||
:param dns_forwarding_ruleset_name: The name of the DNS forwarding ruleset. Required.
|
||||
:type dns_forwarding_ruleset_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a model type or a IO
|
||||
type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsForwardingRulesetPatch or IO
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a
|
||||
DnsForwardingRulesetPatch type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsForwardingRulesetPatch or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either DnsForwardingRuleset or the result
|
||||
of cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsForwardingRuleset]
|
||||
|
@ -526,9 +459,7 @@ class DnsForwardingRulesetsOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.DnsForwardingRuleset] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
|
@ -547,12 +478,13 @@ class DnsForwardingRulesetsOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("DnsForwardingRuleset", pipeline_response)
|
||||
deserialized = self._deserialize("DnsForwardingRuleset", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
|
@ -562,22 +494,20 @@ class DnsForwardingRulesetsOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller.from_continuation_token(
|
||||
return AsyncLROPoller[_models.DnsForwardingRuleset].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
return AsyncLROPoller[_models.DnsForwardingRuleset](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
begin_update.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"
|
||||
}
|
||||
|
||||
async def _delete_initial( # pylint: disable=inconsistent-return-statements
|
||||
async def _delete_initial(
|
||||
self, resource_group_name: str, dns_forwarding_ruleset_name: str, if_match: Optional[str] = None, **kwargs: Any
|
||||
) -> None:
|
||||
error_map = {
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -588,40 +518,42 @@ class DnsForwardingRulesetsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
request = build_delete_request(
|
||||
_request = build_delete_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
template_url=self._delete_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 202, 204]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
_delete_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"
|
||||
}
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace_async
|
||||
async def begin_delete(
|
||||
|
@ -639,14 +571,6 @@ class DnsForwardingRulesetsOperations:
|
|||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[None]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -654,15 +578,13 @@ class DnsForwardingRulesetsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
||||
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
||||
if cont_token is None:
|
||||
raw_result = await self._delete_initial( # type: ignore
|
||||
raw_result = await self._delete_initial(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
if_match=if_match,
|
||||
|
@ -672,11 +594,12 @@ class DnsForwardingRulesetsOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
return cls(pipeline_response, None, {}) # type: ignore
|
||||
|
||||
if polling is True:
|
||||
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
|
||||
|
@ -685,17 +608,13 @@ class DnsForwardingRulesetsOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller.from_continuation_token(
|
||||
return AsyncLROPoller[None].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
begin_delete.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"
|
||||
}
|
||||
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
@distributed_trace_async
|
||||
async def get(
|
||||
|
@ -708,12 +627,11 @@ class DnsForwardingRulesetsOperations:
|
|||
:type resource_group_name: str
|
||||
:param dns_forwarding_ruleset_name: The name of the DNS forwarding ruleset. Required.
|
||||
:type dns_forwarding_ruleset_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: DnsForwardingRuleset or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.DnsForwardingRuleset
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -724,25 +642,22 @@ class DnsForwardingRulesetsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.DnsForwardingRuleset] = kwargs.pop("cls", None)
|
||||
|
||||
request = build_get_request(
|
||||
_request = build_get_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
api_version=api_version,
|
||||
template_url=self.get.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
@ -751,16 +666,12 @@ class DnsForwardingRulesetsOperations:
|
|||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = self._deserialize("DnsForwardingRuleset", pipeline_response)
|
||||
deserialized = self._deserialize("DnsForwardingRuleset", pipeline_response.http_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
get.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def list_by_resource_group(
|
||||
|
@ -774,7 +685,6 @@ class DnsForwardingRulesetsOperations:
|
|||
:param top: The maximum number of results to return. If not specified, returns up to 100
|
||||
results. Default value is None.
|
||||
:type top: int
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: An iterator like instance of either DnsForwardingRuleset or the result of
|
||||
cls(response)
|
||||
:rtype:
|
||||
|
@ -784,12 +694,10 @@ class DnsForwardingRulesetsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.DnsForwardingRulesetListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -800,17 +708,15 @@ class DnsForwardingRulesetsOperations:
|
|||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
request = build_list_by_resource_group_request(
|
||||
_request = build_list_by_resource_group_request(
|
||||
resource_group_name=resource_group_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
top=top,
|
||||
api_version=api_version,
|
||||
template_url=self.list_by_resource_group.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
|
@ -822,13 +728,12 @@ class DnsForwardingRulesetsOperations:
|
|||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
request = HttpRequest(
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
request.method = "GET"
|
||||
return request
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
async def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("DnsForwardingRulesetListResult", pipeline_response)
|
||||
|
@ -838,10 +743,11 @@ class DnsForwardingRulesetsOperations:
|
|||
return deserialized.next_link or None, AsyncList(list_of_elem)
|
||||
|
||||
async def get_next(next_link=None):
|
||||
request = prepare_request(next_link)
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
|
@ -853,10 +759,6 @@ class DnsForwardingRulesetsOperations:
|
|||
|
||||
return AsyncItemPaged(get_next, extract_data)
|
||||
|
||||
list_by_resource_group.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets"
|
||||
}
|
||||
|
||||
@distributed_trace
|
||||
def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncIterable["_models.DnsForwardingRuleset"]:
|
||||
"""Lists DNS forwarding rulesets in all resource groups of a subscription.
|
||||
|
@ -864,7 +766,6 @@ class DnsForwardingRulesetsOperations:
|
|||
:param top: The maximum number of results to return. If not specified, returns up to 100
|
||||
results. Default value is None.
|
||||
:type top: int
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: An iterator like instance of either DnsForwardingRuleset or the result of
|
||||
cls(response)
|
||||
:rtype:
|
||||
|
@ -874,12 +775,10 @@ class DnsForwardingRulesetsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.DnsForwardingRulesetListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -890,16 +789,14 @@ class DnsForwardingRulesetsOperations:
|
|||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
request = build_list_request(
|
||||
_request = build_list_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
top=top,
|
||||
api_version=api_version,
|
||||
template_url=self.list.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
|
@ -911,13 +808,12 @@ class DnsForwardingRulesetsOperations:
|
|||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
request = HttpRequest(
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
request.method = "GET"
|
||||
return request
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
async def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("DnsForwardingRulesetListResult", pipeline_response)
|
||||
|
@ -927,10 +823,11 @@ class DnsForwardingRulesetsOperations:
|
|||
return deserialized.next_link or None, AsyncList(list_of_elem)
|
||||
|
||||
async def get_next(next_link=None):
|
||||
request = prepare_request(next_link)
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
|
@ -942,8 +839,6 @@ class DnsForwardingRulesetsOperations:
|
|||
|
||||
return AsyncItemPaged(get_next, extract_data)
|
||||
|
||||
list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsForwardingRulesets"}
|
||||
|
||||
@distributed_trace
|
||||
def list_by_virtual_network(
|
||||
self, resource_group_name: str, virtual_network_name: str, top: Optional[int] = None, **kwargs: Any
|
||||
|
@ -958,7 +853,6 @@ class DnsForwardingRulesetsOperations:
|
|||
:param top: The maximum number of results to return. If not specified, returns up to 100
|
||||
results. Default value is None.
|
||||
:type top: int
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: An iterator like instance of either VirtualNetworkDnsForwardingRuleset or the result
|
||||
of cls(response)
|
||||
:rtype:
|
||||
|
@ -968,12 +862,10 @@ class DnsForwardingRulesetsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.VirtualNetworkDnsForwardingRulesetListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -984,18 +876,16 @@ class DnsForwardingRulesetsOperations:
|
|||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
request = build_list_by_virtual_network_request(
|
||||
_request = build_list_by_virtual_network_request(
|
||||
resource_group_name=resource_group_name,
|
||||
virtual_network_name=virtual_network_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
top=top,
|
||||
api_version=api_version,
|
||||
template_url=self.list_by_virtual_network.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
|
@ -1007,13 +897,12 @@ class DnsForwardingRulesetsOperations:
|
|||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
request = HttpRequest(
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
request.method = "GET"
|
||||
return request
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
async def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("VirtualNetworkDnsForwardingRulesetListResult", pipeline_response)
|
||||
|
@ -1023,10 +912,11 @@ class DnsForwardingRulesetsOperations:
|
|||
return deserialized.next_link or None, AsyncList(list_of_elem)
|
||||
|
||||
async def get_next(next_link=None):
|
||||
request = prepare_request(next_link)
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
|
@ -1037,7 +927,3 @@ class DnsForwardingRulesetsOperations:
|
|||
return pipeline_response
|
||||
|
||||
return AsyncItemPaged(get_next, extract_data)
|
||||
|
||||
list_by_virtual_network.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listDnsForwardingRulesets"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,866 @@
|
|||
# pylint: disable=too-many-lines,too-many-statements
|
||||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
from io import IOBase
|
||||
import sys
|
||||
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
|
||||
import urllib.parse
|
||||
|
||||
from azure.core.async_paging import AsyncItemPaged, AsyncList
|
||||
from azure.core.exceptions import (
|
||||
ClientAuthenticationError,
|
||||
HttpResponseError,
|
||||
ResourceExistsError,
|
||||
ResourceNotFoundError,
|
||||
ResourceNotModifiedError,
|
||||
StreamClosedError,
|
||||
StreamConsumedError,
|
||||
map_error,
|
||||
)
|
||||
from azure.core.pipeline import PipelineResponse
|
||||
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
|
||||
from azure.core.rest import AsyncHttpResponse, HttpRequest
|
||||
from azure.core.tracing.decorator import distributed_trace
|
||||
from azure.core.tracing.decorator_async import distributed_trace_async
|
||||
from azure.core.utils import case_insensitive_dict
|
||||
from azure.mgmt.core.exceptions import ARMErrorFormat
|
||||
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
|
||||
|
||||
from ... import models as _models
|
||||
from ...operations._dns_resolver_domain_lists_operations import (
|
||||
build_create_or_update_request,
|
||||
build_delete_request,
|
||||
build_get_request,
|
||||
build_list_by_resource_group_request,
|
||||
build_list_request,
|
||||
build_update_request,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from collections.abc import MutableMapping
|
||||
else:
|
||||
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
|
||||
T = TypeVar("T")
|
||||
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
|
||||
|
||||
|
||||
class DnsResolverDomainListsOperations:
|
||||
"""
|
||||
.. warning::
|
||||
**DO NOT** instantiate this class directly.
|
||||
|
||||
Instead, you should access the following operations through
|
||||
:class:`~azure.mgmt.dnsresolver.aio.DnsResolverManagementClient`'s
|
||||
:attr:`dns_resolver_domain_lists` attribute.
|
||||
"""
|
||||
|
||||
models = _models
|
||||
|
||||
def __init__(self, *args, **kwargs) -> None:
|
||||
input_args = list(args)
|
||||
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
|
||||
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
|
||||
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
|
||||
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
|
||||
|
||||
async def _create_or_update_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_domain_list_name: str,
|
||||
parameters: Union[_models.DnsResolverDomainList, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "DnsResolverDomainList")
|
||||
|
||||
_request = build_create_or_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_domain_list_name=dns_resolver_domain_list_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
if_none_match=if_none_match,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 201]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
async def begin_create_or_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_domain_list_name: str,
|
||||
parameters: _models.DnsResolverDomainList,
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsResolverDomainList]:
|
||||
"""Creates or updates a DNS resolver domain list.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_domain_list_name: The name of the DNS resolver domain list. Required.
|
||||
:type dns_resolver_domain_list_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsResolverDomainList
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolverDomainList or the result
|
||||
of cls(response)
|
||||
:rtype:
|
||||
~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolverDomainList]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
|
||||
@overload
|
||||
async def begin_create_or_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_domain_list_name: str,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsResolverDomainList]:
|
||||
"""Creates or updates a DNS resolver domain list.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_domain_list_name: The name of the DNS resolver domain list. Required.
|
||||
:type dns_resolver_domain_list_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Required.
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolverDomainList or the result
|
||||
of cls(response)
|
||||
:rtype:
|
||||
~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolverDomainList]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
|
||||
@distributed_trace_async
|
||||
async def begin_create_or_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_domain_list_name: str,
|
||||
parameters: Union[_models.DnsResolverDomainList, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsResolverDomainList]:
|
||||
"""Creates or updates a DNS resolver domain list.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_domain_list_name: The name of the DNS resolver domain list. Required.
|
||||
:type dns_resolver_domain_list_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a
|
||||
DnsResolverDomainList type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsResolverDomainList or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolverDomainList or the result
|
||||
of cls(response)
|
||||
:rtype:
|
||||
~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolverDomainList]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.DnsResolverDomainList] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
||||
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
||||
if cont_token is None:
|
||||
raw_result = await self._create_or_update_initial(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_domain_list_name=dns_resolver_domain_list_name,
|
||||
parameters=parameters,
|
||||
if_match=if_match,
|
||||
if_none_match=if_none_match,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
cls=lambda x, y, z: x,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("DnsResolverDomainList", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
|
||||
elif polling is False:
|
||||
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
|
||||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller[_models.DnsResolverDomainList].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller[_models.DnsResolverDomainList](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
async def _update_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_domain_list_name: str,
|
||||
parameters: Union[_models.DnsResolverDomainListPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "DnsResolverDomainListPatch")
|
||||
|
||||
_request = build_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_domain_list_name=dns_resolver_domain_list_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 202]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
response_headers = {}
|
||||
if response.status_code == 202:
|
||||
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
|
||||
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, response_headers) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
async def begin_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_domain_list_name: str,
|
||||
parameters: _models.DnsResolverDomainListPatch,
|
||||
if_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsResolverDomainList]:
|
||||
"""Updates a DNS resolver domain list.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_domain_list_name: The name of the DNS resolver domain list. Required.
|
||||
:type dns_resolver_domain_list_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsResolverDomainListPatch
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolverDomainList or the result
|
||||
of cls(response)
|
||||
:rtype:
|
||||
~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolverDomainList]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
|
||||
@overload
|
||||
async def begin_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_domain_list_name: str,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsResolverDomainList]:
|
||||
"""Updates a DNS resolver domain list.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_domain_list_name: The name of the DNS resolver domain list. Required.
|
||||
:type dns_resolver_domain_list_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Required.
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolverDomainList or the result
|
||||
of cls(response)
|
||||
:rtype:
|
||||
~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolverDomainList]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
|
||||
@distributed_trace_async
|
||||
async def begin_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_domain_list_name: str,
|
||||
parameters: Union[_models.DnsResolverDomainListPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsResolverDomainList]:
|
||||
"""Updates a DNS resolver domain list.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_domain_list_name: The name of the DNS resolver domain list. Required.
|
||||
:type dns_resolver_domain_list_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a
|
||||
DnsResolverDomainListPatch type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsResolverDomainListPatch or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolverDomainList or the result
|
||||
of cls(response)
|
||||
:rtype:
|
||||
~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolverDomainList]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.DnsResolverDomainList] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
||||
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
||||
if cont_token is None:
|
||||
raw_result = await self._update_initial(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_domain_list_name=dns_resolver_domain_list_name,
|
||||
parameters=parameters,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
cls=lambda x, y, z: x,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("DnsResolverDomainList", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
|
||||
elif polling is False:
|
||||
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
|
||||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller[_models.DnsResolverDomainList].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller[_models.DnsResolverDomainList](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
async def _delete_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_domain_list_name: str,
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
_request = build_delete_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_domain_list_name=dns_resolver_domain_list_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [202, 204]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
response_headers = {}
|
||||
if response.status_code == 202:
|
||||
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
|
||||
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, response_headers) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace_async
|
||||
async def begin_delete(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_domain_list_name: str,
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[None]:
|
||||
"""Deletes a DNS resolver domain list. WARNING: This operation cannot be undone.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_domain_list_name: The name of the DNS resolver domain list. Required.
|
||||
:type dns_resolver_domain_list_name: str
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[None]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
||||
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
||||
if cont_token is None:
|
||||
raw_result = await self._delete_initial(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_domain_list_name=dns_resolver_domain_list_name,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
cls=lambda x, y, z: x,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {}) # type: ignore
|
||||
|
||||
if polling is True:
|
||||
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
|
||||
elif polling is False:
|
||||
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
|
||||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller[None].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
@distributed_trace_async
|
||||
async def get(
|
||||
self, resource_group_name: str, dns_resolver_domain_list_name: str, **kwargs: Any
|
||||
) -> _models.DnsResolverDomainList:
|
||||
"""Gets properties of a DNS resolver domain list.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_domain_list_name: The name of the DNS resolver domain list. Required.
|
||||
:type dns_resolver_domain_list_name: str
|
||||
:return: DnsResolverDomainList or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.DnsResolverDomainList
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.DnsResolverDomainList] = kwargs.pop("cls", None)
|
||||
|
||||
_request = build_get_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_domain_list_name=dns_resolver_domain_list_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
api_version=api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = self._deserialize("DnsResolverDomainList", pipeline_response.http_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def list_by_resource_group(
|
||||
self, resource_group_name: str, top: Optional[int] = None, **kwargs: Any
|
||||
) -> AsyncIterable["_models.DnsResolverDomainList"]:
|
||||
"""Lists DNS resolver domain lists within a resource group.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param top: The maximum number of results to return. If not specified, returns up to 100
|
||||
results. Default value is None.
|
||||
:type top: int
|
||||
:return: An iterator like instance of either DnsResolverDomainList or the result of
|
||||
cls(response)
|
||||
:rtype:
|
||||
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.DnsResolverDomainList]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.DnsResolverDomainListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
_request = build_list_by_resource_group_request(
|
||||
resource_group_name=resource_group_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
top=top,
|
||||
api_version=api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
_parsed_next_link = urllib.parse.urlparse(next_link)
|
||||
_next_request_params = case_insensitive_dict(
|
||||
{
|
||||
key: [urllib.parse.quote(v) for v in value]
|
||||
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
|
||||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
async def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("DnsResolverDomainListResult", pipeline_response)
|
||||
list_of_elem = deserialized.value
|
||||
if cls:
|
||||
list_of_elem = cls(list_of_elem) # type: ignore
|
||||
return deserialized.next_link or None, AsyncList(list_of_elem)
|
||||
|
||||
async def get_next(next_link=None):
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
return pipeline_response
|
||||
|
||||
return AsyncItemPaged(get_next, extract_data)
|
||||
|
||||
@distributed_trace
|
||||
def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncIterable["_models.DnsResolverDomainList"]:
|
||||
"""Lists DNS resolver domain lists in all resource groups of a subscription.
|
||||
|
||||
:param top: The maximum number of results to return. If not specified, returns up to 100
|
||||
results. Default value is None.
|
||||
:type top: int
|
||||
:return: An iterator like instance of either DnsResolverDomainList or the result of
|
||||
cls(response)
|
||||
:rtype:
|
||||
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.DnsResolverDomainList]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.DnsResolverDomainListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
_request = build_list_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
top=top,
|
||||
api_version=api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
_parsed_next_link = urllib.parse.urlparse(next_link)
|
||||
_next_request_params = case_insensitive_dict(
|
||||
{
|
||||
key: [urllib.parse.quote(v) for v in value]
|
||||
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
|
||||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
async def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("DnsResolverDomainListResult", pipeline_response)
|
||||
list_of_elem = deserialized.value
|
||||
if cls:
|
||||
list_of_elem = cls(list_of_elem) # type: ignore
|
||||
return deserialized.next_link or None, AsyncList(list_of_elem)
|
||||
|
||||
async def get_next(next_link=None):
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
return pipeline_response
|
||||
|
||||
return AsyncItemPaged(get_next, extract_data)
|
|
@ -0,0 +1,935 @@
|
|||
# pylint: disable=too-many-lines,too-many-statements
|
||||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
from io import IOBase
|
||||
import sys
|
||||
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
|
||||
import urllib.parse
|
||||
|
||||
from azure.core.async_paging import AsyncItemPaged, AsyncList
|
||||
from azure.core.exceptions import (
|
||||
ClientAuthenticationError,
|
||||
HttpResponseError,
|
||||
ResourceExistsError,
|
||||
ResourceNotFoundError,
|
||||
ResourceNotModifiedError,
|
||||
StreamClosedError,
|
||||
StreamConsumedError,
|
||||
map_error,
|
||||
)
|
||||
from azure.core.pipeline import PipelineResponse
|
||||
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
|
||||
from azure.core.rest import AsyncHttpResponse, HttpRequest
|
||||
from azure.core.tracing.decorator import distributed_trace
|
||||
from azure.core.tracing.decorator_async import distributed_trace_async
|
||||
from azure.core.utils import case_insensitive_dict
|
||||
from azure.mgmt.core.exceptions import ARMErrorFormat
|
||||
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
|
||||
|
||||
from ... import models as _models
|
||||
from ...operations._dns_resolver_policies_operations import (
|
||||
build_create_or_update_request,
|
||||
build_delete_request,
|
||||
build_get_request,
|
||||
build_list_by_resource_group_request,
|
||||
build_list_by_virtual_network_request,
|
||||
build_list_request,
|
||||
build_update_request,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from collections.abc import MutableMapping
|
||||
else:
|
||||
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
|
||||
T = TypeVar("T")
|
||||
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
|
||||
|
||||
|
||||
class DnsResolverPoliciesOperations:
|
||||
"""
|
||||
.. warning::
|
||||
**DO NOT** instantiate this class directly.
|
||||
|
||||
Instead, you should access the following operations through
|
||||
:class:`~azure.mgmt.dnsresolver.aio.DnsResolverManagementClient`'s
|
||||
:attr:`dns_resolver_policies` attribute.
|
||||
"""
|
||||
|
||||
models = _models
|
||||
|
||||
def __init__(self, *args, **kwargs) -> None:
|
||||
input_args = list(args)
|
||||
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
|
||||
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
|
||||
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
|
||||
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
|
||||
|
||||
async def _create_or_update_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
parameters: Union[_models.DnsResolverPolicy, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "DnsResolverPolicy")
|
||||
|
||||
_request = build_create_or_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
if_none_match=if_none_match,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 201]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
async def begin_create_or_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
parameters: _models.DnsResolverPolicy,
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsResolverPolicy]:
|
||||
"""Creates or updates a DNS resolver policy.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsResolverPolicy
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolverPolicy or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolverPolicy]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
|
||||
@overload
|
||||
async def begin_create_or_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsResolverPolicy]:
|
||||
"""Creates or updates a DNS resolver policy.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Required.
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolverPolicy or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolverPolicy]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
|
||||
@distributed_trace_async
|
||||
async def begin_create_or_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
parameters: Union[_models.DnsResolverPolicy, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsResolverPolicy]:
|
||||
"""Creates or updates a DNS resolver policy.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a
|
||||
DnsResolverPolicy type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsResolverPolicy or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolverPolicy or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolverPolicy]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.DnsResolverPolicy] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
||||
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
||||
if cont_token is None:
|
||||
raw_result = await self._create_or_update_initial(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
parameters=parameters,
|
||||
if_match=if_match,
|
||||
if_none_match=if_none_match,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
cls=lambda x, y, z: x,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("DnsResolverPolicy", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
|
||||
elif polling is False:
|
||||
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
|
||||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller[_models.DnsResolverPolicy].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller[_models.DnsResolverPolicy](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
async def _update_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
parameters: Union[_models.DnsResolverPolicyPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "DnsResolverPolicyPatch")
|
||||
|
||||
_request = build_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 202]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
response_headers = {}
|
||||
if response.status_code == 202:
|
||||
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
|
||||
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, response_headers) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
async def begin_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
parameters: _models.DnsResolverPolicyPatch,
|
||||
if_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsResolverPolicy]:
|
||||
"""Updates a DNS resolver policy.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsResolverPolicyPatch
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolverPolicy or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolverPolicy]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
|
||||
@overload
|
||||
async def begin_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsResolverPolicy]:
|
||||
"""Updates a DNS resolver policy.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Required.
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolverPolicy or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolverPolicy]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
|
||||
@distributed_trace_async
|
||||
async def begin_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
parameters: Union[_models.DnsResolverPolicyPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsResolverPolicy]:
|
||||
"""Updates a DNS resolver policy.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a
|
||||
DnsResolverPolicyPatch type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsResolverPolicyPatch or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolverPolicy or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolverPolicy]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.DnsResolverPolicy] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
||||
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
||||
if cont_token is None:
|
||||
raw_result = await self._update_initial(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
parameters=parameters,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
cls=lambda x, y, z: x,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("DnsResolverPolicy", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
|
||||
elif polling is False:
|
||||
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
|
||||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller[_models.DnsResolverPolicy].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller[_models.DnsResolverPolicy](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
async def _delete_initial(
|
||||
self, resource_group_name: str, dns_resolver_policy_name: str, if_match: Optional[str] = None, **kwargs: Any
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
_request = build_delete_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [202, 204]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
response_headers = {}
|
||||
if response.status_code == 202:
|
||||
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
|
||||
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, response_headers) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace_async
|
||||
async def begin_delete(
|
||||
self, resource_group_name: str, dns_resolver_policy_name: str, if_match: Optional[str] = None, **kwargs: Any
|
||||
) -> AsyncLROPoller[None]:
|
||||
"""Deletes a DNS resolver policy. WARNING: This operation cannot be undone.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[None]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
||||
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
||||
if cont_token is None:
|
||||
raw_result = await self._delete_initial(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
cls=lambda x, y, z: x,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {}) # type: ignore
|
||||
|
||||
if polling is True:
|
||||
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
|
||||
elif polling is False:
|
||||
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
|
||||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller[None].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
@distributed_trace_async
|
||||
async def get(
|
||||
self, resource_group_name: str, dns_resolver_policy_name: str, **kwargs: Any
|
||||
) -> _models.DnsResolverPolicy:
|
||||
"""Gets properties of a DNS resolver policy.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:return: DnsResolverPolicy or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.DnsResolverPolicy
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.DnsResolverPolicy] = kwargs.pop("cls", None)
|
||||
|
||||
_request = build_get_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
api_version=api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = self._deserialize("DnsResolverPolicy", pipeline_response.http_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def list_by_resource_group(
|
||||
self, resource_group_name: str, top: Optional[int] = None, **kwargs: Any
|
||||
) -> AsyncIterable["_models.DnsResolverPolicy"]:
|
||||
"""Lists DNS resolver policies within a resource group.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param top: The maximum number of results to return. If not specified, returns up to 100
|
||||
results. Default value is None.
|
||||
:type top: int
|
||||
:return: An iterator like instance of either DnsResolverPolicy or the result of cls(response)
|
||||
:rtype:
|
||||
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.DnsResolverPolicy]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.DnsResolverPolicyListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
_request = build_list_by_resource_group_request(
|
||||
resource_group_name=resource_group_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
top=top,
|
||||
api_version=api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
_parsed_next_link = urllib.parse.urlparse(next_link)
|
||||
_next_request_params = case_insensitive_dict(
|
||||
{
|
||||
key: [urllib.parse.quote(v) for v in value]
|
||||
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
|
||||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
async def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("DnsResolverPolicyListResult", pipeline_response)
|
||||
list_of_elem = deserialized.value
|
||||
if cls:
|
||||
list_of_elem = cls(list_of_elem) # type: ignore
|
||||
return deserialized.next_link or None, AsyncList(list_of_elem)
|
||||
|
||||
async def get_next(next_link=None):
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
return pipeline_response
|
||||
|
||||
return AsyncItemPaged(get_next, extract_data)
|
||||
|
||||
@distributed_trace
|
||||
def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncIterable["_models.DnsResolverPolicy"]:
|
||||
"""Lists DNS resolver policies in all resource groups of a subscription.
|
||||
|
||||
:param top: The maximum number of results to return. If not specified, returns up to 100
|
||||
results. Default value is None.
|
||||
:type top: int
|
||||
:return: An iterator like instance of either DnsResolverPolicy or the result of cls(response)
|
||||
:rtype:
|
||||
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.DnsResolverPolicy]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.DnsResolverPolicyListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
_request = build_list_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
top=top,
|
||||
api_version=api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
_parsed_next_link = urllib.parse.urlparse(next_link)
|
||||
_next_request_params = case_insensitive_dict(
|
||||
{
|
||||
key: [urllib.parse.quote(v) for v in value]
|
||||
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
|
||||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
async def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("DnsResolverPolicyListResult", pipeline_response)
|
||||
list_of_elem = deserialized.value
|
||||
if cls:
|
||||
list_of_elem = cls(list_of_elem) # type: ignore
|
||||
return deserialized.next_link or None, AsyncList(list_of_elem)
|
||||
|
||||
async def get_next(next_link=None):
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
return pipeline_response
|
||||
|
||||
return AsyncItemPaged(get_next, extract_data)
|
||||
|
||||
@distributed_trace
|
||||
def list_by_virtual_network(
|
||||
self, resource_group_name: str, virtual_network_name: str, **kwargs: Any
|
||||
) -> AsyncIterable["_models.SubResource"]:
|
||||
"""Lists DNS resolver policy resource IDs linked to a virtual network.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param virtual_network_name: The name of the virtual network. Required.
|
||||
:type virtual_network_name: str
|
||||
:return: An iterator like instance of either SubResource or the result of cls(response)
|
||||
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.SubResource]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.SubResourceListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
_request = build_list_by_virtual_network_request(
|
||||
resource_group_name=resource_group_name,
|
||||
virtual_network_name=virtual_network_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
api_version=api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
_parsed_next_link = urllib.parse.urlparse(next_link)
|
||||
_next_request_params = case_insensitive_dict(
|
||||
{
|
||||
key: [urllib.parse.quote(v) for v in value]
|
||||
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
|
||||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
async def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("SubResourceListResult", pipeline_response)
|
||||
list_of_elem = deserialized.value
|
||||
if cls:
|
||||
list_of_elem = cls(list_of_elem) # type: ignore
|
||||
return deserialized.next_link or None, AsyncList(list_of_elem)
|
||||
|
||||
async def get_next(next_link=None):
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
return pipeline_response
|
||||
|
||||
return AsyncItemPaged(get_next, extract_data)
|
|
@ -0,0 +1,834 @@
|
|||
# pylint: disable=too-many-lines,too-many-statements
|
||||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
from io import IOBase
|
||||
import sys
|
||||
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
|
||||
import urllib.parse
|
||||
|
||||
from azure.core.async_paging import AsyncItemPaged, AsyncList
|
||||
from azure.core.exceptions import (
|
||||
ClientAuthenticationError,
|
||||
HttpResponseError,
|
||||
ResourceExistsError,
|
||||
ResourceNotFoundError,
|
||||
ResourceNotModifiedError,
|
||||
StreamClosedError,
|
||||
StreamConsumedError,
|
||||
map_error,
|
||||
)
|
||||
from azure.core.pipeline import PipelineResponse
|
||||
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
|
||||
from azure.core.rest import AsyncHttpResponse, HttpRequest
|
||||
from azure.core.tracing.decorator import distributed_trace
|
||||
from azure.core.tracing.decorator_async import distributed_trace_async
|
||||
from azure.core.utils import case_insensitive_dict
|
||||
from azure.mgmt.core.exceptions import ARMErrorFormat
|
||||
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
|
||||
|
||||
from ... import models as _models
|
||||
from ...operations._dns_resolver_policy_virtual_network_links_operations import (
|
||||
build_create_or_update_request,
|
||||
build_delete_request,
|
||||
build_get_request,
|
||||
build_list_request,
|
||||
build_update_request,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from collections.abc import MutableMapping
|
||||
else:
|
||||
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
|
||||
T = TypeVar("T")
|
||||
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
|
||||
|
||||
|
||||
class DnsResolverPolicyVirtualNetworkLinksOperations: # pylint: disable=name-too-long
|
||||
"""
|
||||
.. warning::
|
||||
**DO NOT** instantiate this class directly.
|
||||
|
||||
Instead, you should access the following operations through
|
||||
:class:`~azure.mgmt.dnsresolver.aio.DnsResolverManagementClient`'s
|
||||
:attr:`dns_resolver_policy_virtual_network_links` attribute.
|
||||
"""
|
||||
|
||||
models = _models
|
||||
|
||||
def __init__(self, *args, **kwargs) -> None:
|
||||
input_args = list(args)
|
||||
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
|
||||
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
|
||||
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
|
||||
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
|
||||
|
||||
async def _create_or_update_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_resolver_policy_virtual_network_link_name: str,
|
||||
parameters: Union[_models.DnsResolverPolicyVirtualNetworkLink, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "DnsResolverPolicyVirtualNetworkLink")
|
||||
|
||||
_request = build_create_or_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
dns_resolver_policy_virtual_network_link_name=dns_resolver_policy_virtual_network_link_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
if_none_match=if_none_match,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 201]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
async def begin_create_or_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_resolver_policy_virtual_network_link_name: str,
|
||||
parameters: _models.DnsResolverPolicyVirtualNetworkLink,
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsResolverPolicyVirtualNetworkLink]:
|
||||
"""Creates or updates a DNS resolver policy virtual network link.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param dns_resolver_policy_virtual_network_link_name: The name of the DNS resolver policy
|
||||
virtual network link for the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_virtual_network_link_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsResolverPolicyVirtualNetworkLink
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolverPolicyVirtualNetworkLink
|
||||
or the result of cls(response)
|
||||
:rtype:
|
||||
~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolverPolicyVirtualNetworkLink]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
|
||||
@overload
|
||||
async def begin_create_or_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_resolver_policy_virtual_network_link_name: str,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsResolverPolicyVirtualNetworkLink]:
|
||||
"""Creates or updates a DNS resolver policy virtual network link.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param dns_resolver_policy_virtual_network_link_name: The name of the DNS resolver policy
|
||||
virtual network link for the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_virtual_network_link_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Required.
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolverPolicyVirtualNetworkLink
|
||||
or the result of cls(response)
|
||||
:rtype:
|
||||
~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolverPolicyVirtualNetworkLink]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
|
||||
@distributed_trace_async
|
||||
async def begin_create_or_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_resolver_policy_virtual_network_link_name: str,
|
||||
parameters: Union[_models.DnsResolverPolicyVirtualNetworkLink, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsResolverPolicyVirtualNetworkLink]:
|
||||
"""Creates or updates a DNS resolver policy virtual network link.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param dns_resolver_policy_virtual_network_link_name: The name of the DNS resolver policy
|
||||
virtual network link for the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_virtual_network_link_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a
|
||||
DnsResolverPolicyVirtualNetworkLink type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsResolverPolicyVirtualNetworkLink or
|
||||
IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolverPolicyVirtualNetworkLink
|
||||
or the result of cls(response)
|
||||
:rtype:
|
||||
~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolverPolicyVirtualNetworkLink]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.DnsResolverPolicyVirtualNetworkLink] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
||||
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
||||
if cont_token is None:
|
||||
raw_result = await self._create_or_update_initial(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
dns_resolver_policy_virtual_network_link_name=dns_resolver_policy_virtual_network_link_name,
|
||||
parameters=parameters,
|
||||
if_match=if_match,
|
||||
if_none_match=if_none_match,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
cls=lambda x, y, z: x,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("DnsResolverPolicyVirtualNetworkLink", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
|
||||
elif polling is False:
|
||||
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
|
||||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller[_models.DnsResolverPolicyVirtualNetworkLink].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller[_models.DnsResolverPolicyVirtualNetworkLink](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
async def _update_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_resolver_policy_virtual_network_link_name: str,
|
||||
parameters: Union[_models.DnsResolverPolicyVirtualNetworkLinkPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "DnsResolverPolicyVirtualNetworkLinkPatch")
|
||||
|
||||
_request = build_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
dns_resolver_policy_virtual_network_link_name=dns_resolver_policy_virtual_network_link_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 202]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
response_headers = {}
|
||||
if response.status_code == 202:
|
||||
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
|
||||
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, response_headers) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
async def begin_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_resolver_policy_virtual_network_link_name: str,
|
||||
parameters: _models.DnsResolverPolicyVirtualNetworkLinkPatch,
|
||||
if_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsResolverPolicyVirtualNetworkLink]:
|
||||
"""Updates a DNS resolver policy virtual network link.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param dns_resolver_policy_virtual_network_link_name: The name of the DNS resolver policy
|
||||
virtual network link for the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_virtual_network_link_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsResolverPolicyVirtualNetworkLinkPatch
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolverPolicyVirtualNetworkLink
|
||||
or the result of cls(response)
|
||||
:rtype:
|
||||
~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolverPolicyVirtualNetworkLink]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
|
||||
@overload
|
||||
async def begin_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_resolver_policy_virtual_network_link_name: str,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsResolverPolicyVirtualNetworkLink]:
|
||||
"""Updates a DNS resolver policy virtual network link.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param dns_resolver_policy_virtual_network_link_name: The name of the DNS resolver policy
|
||||
virtual network link for the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_virtual_network_link_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Required.
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolverPolicyVirtualNetworkLink
|
||||
or the result of cls(response)
|
||||
:rtype:
|
||||
~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolverPolicyVirtualNetworkLink]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
|
||||
@distributed_trace_async
|
||||
async def begin_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_resolver_policy_virtual_network_link_name: str,
|
||||
parameters: Union[_models.DnsResolverPolicyVirtualNetworkLinkPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsResolverPolicyVirtualNetworkLink]:
|
||||
"""Updates a DNS resolver policy virtual network link.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param dns_resolver_policy_virtual_network_link_name: The name of the DNS resolver policy
|
||||
virtual network link for the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_virtual_network_link_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a
|
||||
DnsResolverPolicyVirtualNetworkLinkPatch type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsResolverPolicyVirtualNetworkLinkPatch or
|
||||
IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolverPolicyVirtualNetworkLink
|
||||
or the result of cls(response)
|
||||
:rtype:
|
||||
~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolverPolicyVirtualNetworkLink]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.DnsResolverPolicyVirtualNetworkLink] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
||||
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
||||
if cont_token is None:
|
||||
raw_result = await self._update_initial(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
dns_resolver_policy_virtual_network_link_name=dns_resolver_policy_virtual_network_link_name,
|
||||
parameters=parameters,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
cls=lambda x, y, z: x,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("DnsResolverPolicyVirtualNetworkLink", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
|
||||
elif polling is False:
|
||||
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
|
||||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller[_models.DnsResolverPolicyVirtualNetworkLink].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller[_models.DnsResolverPolicyVirtualNetworkLink](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
async def _delete_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_resolver_policy_virtual_network_link_name: str,
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
_request = build_delete_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
dns_resolver_policy_virtual_network_link_name=dns_resolver_policy_virtual_network_link_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [202, 204]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
response_headers = {}
|
||||
if response.status_code == 202:
|
||||
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
|
||||
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, response_headers) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace_async
|
||||
async def begin_delete(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_resolver_policy_virtual_network_link_name: str,
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[None]:
|
||||
"""Deletes a DNS resolver policy virtual network link. WARNING: This operation cannot be undone.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param dns_resolver_policy_virtual_network_link_name: The name of the DNS resolver policy
|
||||
virtual network link for the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_virtual_network_link_name: str
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[None]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
||||
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
||||
if cont_token is None:
|
||||
raw_result = await self._delete_initial(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
dns_resolver_policy_virtual_network_link_name=dns_resolver_policy_virtual_network_link_name,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
cls=lambda x, y, z: x,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {}) # type: ignore
|
||||
|
||||
if polling is True:
|
||||
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
|
||||
elif polling is False:
|
||||
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
|
||||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller[None].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
@distributed_trace_async
|
||||
async def get(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_resolver_policy_virtual_network_link_name: str,
|
||||
**kwargs: Any
|
||||
) -> _models.DnsResolverPolicyVirtualNetworkLink:
|
||||
"""Gets properties of a DNS resolver policy virtual network link.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param dns_resolver_policy_virtual_network_link_name: The name of the DNS resolver policy
|
||||
virtual network link for the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_virtual_network_link_name: str
|
||||
:return: DnsResolverPolicyVirtualNetworkLink or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.DnsResolverPolicyVirtualNetworkLink
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.DnsResolverPolicyVirtualNetworkLink] = kwargs.pop("cls", None)
|
||||
|
||||
_request = build_get_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
dns_resolver_policy_virtual_network_link_name=dns_resolver_policy_virtual_network_link_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
api_version=api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = self._deserialize("DnsResolverPolicyVirtualNetworkLink", pipeline_response.http_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def list(
|
||||
self, resource_group_name: str, dns_resolver_policy_name: str, top: Optional[int] = None, **kwargs: Any
|
||||
) -> AsyncIterable["_models.DnsResolverPolicyVirtualNetworkLink"]:
|
||||
"""Lists DNS resolver policy virtual network links.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param top: The maximum number of results to return. If not specified, returns up to 100
|
||||
results. Default value is None.
|
||||
:type top: int
|
||||
:return: An iterator like instance of either DnsResolverPolicyVirtualNetworkLink or the result
|
||||
of cls(response)
|
||||
:rtype:
|
||||
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.DnsResolverPolicyVirtualNetworkLink]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.DnsResolverPolicyVirtualNetworkLinkListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
_request = build_list_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
top=top,
|
||||
api_version=api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
_parsed_next_link = urllib.parse.urlparse(next_link)
|
||||
_next_request_params = case_insensitive_dict(
|
||||
{
|
||||
key: [urllib.parse.quote(v) for v in value]
|
||||
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
|
||||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
async def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("DnsResolverPolicyVirtualNetworkLinkListResult", pipeline_response)
|
||||
list_of_elem = deserialized.value
|
||||
if cls:
|
||||
list_of_elem = cls(list_of_elem) # type: ignore
|
||||
return deserialized.next_link or None, AsyncList(list_of_elem)
|
||||
|
||||
async def get_next(next_link=None):
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
return pipeline_response
|
||||
|
||||
return AsyncItemPaged(get_next, extract_data)
|
|
@ -1,4 +1,4 @@
|
|||
# pylint: disable=too-many-lines
|
||||
# pylint: disable=too-many-lines,too-many-statements
|
||||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
@ -6,8 +6,9 @@
|
|||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
from io import IOBase
|
||||
import sys
|
||||
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
|
||||
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
|
||||
import urllib.parse
|
||||
|
||||
from azure.core.async_paging import AsyncItemPaged, AsyncList
|
||||
|
@ -17,12 +18,13 @@ from azure.core.exceptions import (
|
|||
ResourceExistsError,
|
||||
ResourceNotFoundError,
|
||||
ResourceNotModifiedError,
|
||||
StreamClosedError,
|
||||
StreamConsumedError,
|
||||
map_error,
|
||||
)
|
||||
from azure.core.pipeline import PipelineResponse
|
||||
from azure.core.pipeline.transport import AsyncHttpResponse
|
||||
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
|
||||
from azure.core.rest import HttpRequest
|
||||
from azure.core.rest import AsyncHttpResponse, HttpRequest
|
||||
from azure.core.tracing.decorator import distributed_trace
|
||||
from azure.core.tracing.decorator_async import distributed_trace_async
|
||||
from azure.core.utils import case_insensitive_dict
|
||||
|
@ -30,7 +32,6 @@ from azure.mgmt.core.exceptions import ARMErrorFormat
|
|||
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
|
||||
|
||||
from ... import models as _models
|
||||
from ..._vendor import _convert_request
|
||||
from ...operations._dns_resolvers_operations import (
|
||||
build_create_or_update_request,
|
||||
build_delete_request,
|
||||
|
@ -41,10 +42,10 @@ from ...operations._dns_resolvers_operations import (
|
|||
build_update_request,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
|
||||
if sys.version_info >= (3, 9):
|
||||
from collections.abc import MutableMapping
|
||||
else:
|
||||
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
|
||||
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
|
||||
T = TypeVar("T")
|
||||
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
|
||||
|
||||
|
@ -72,12 +73,12 @@ class DnsResolversOperations:
|
|||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
parameters: Union[_models.DnsResolver, IO],
|
||||
parameters: Union[_models.DnsResolver, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> Optional[_models.DnsResolver]:
|
||||
error_map = {
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -88,21 +89,19 @@ class DnsResolversOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[Optional[_models.DnsResolver]] = kwargs.pop("cls", None)
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IO, bytes)):
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "DnsResolver")
|
||||
|
||||
request = build_create_or_update_request(
|
||||
_request = build_create_or_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
|
@ -112,38 +111,33 @@ class DnsResolversOperations:
|
|||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
template_url=self._create_or_update_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 201, 202]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = None
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize("DnsResolver", pipeline_response)
|
||||
|
||||
if response.status_code == 201:
|
||||
deserialized = self._deserialize("DnsResolver", pipeline_response)
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
_create_or_update_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
async def begin_create_or_update(
|
||||
|
@ -176,14 +170,6 @@ class DnsResolversOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolver or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolver]
|
||||
|
@ -195,7 +181,7 @@ class DnsResolversOperations:
|
|||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
parameters: IO,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
*,
|
||||
|
@ -210,7 +196,7 @@ class DnsResolversOperations:
|
|||
:param dns_resolver_name: The name of the DNS resolver. Required.
|
||||
:type dns_resolver_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Required.
|
||||
:type parameters: IO
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -221,14 +207,6 @@ class DnsResolversOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolver or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolver]
|
||||
|
@ -240,7 +218,7 @@ class DnsResolversOperations:
|
|||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
parameters: Union[_models.DnsResolver, IO],
|
||||
parameters: Union[_models.DnsResolver, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
|
@ -252,9 +230,9 @@ class DnsResolversOperations:
|
|||
:type resource_group_name: str
|
||||
:param dns_resolver_name: The name of the DNS resolver. Required.
|
||||
:type dns_resolver_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a model type
|
||||
or a IO type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsResolver or IO
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a DnsResolver
|
||||
type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsResolver or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -262,17 +240,6 @@ class DnsResolversOperations:
|
|||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolver or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolver]
|
||||
|
@ -281,9 +248,7 @@ class DnsResolversOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.DnsResolver] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
|
@ -303,12 +268,13 @@ class DnsResolversOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("DnsResolver", pipeline_response)
|
||||
deserialized = self._deserialize("DnsResolver", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
|
@ -318,27 +284,25 @@ class DnsResolversOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller.from_continuation_token(
|
||||
return AsyncLROPoller[_models.DnsResolver].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
begin_create_or_update.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"
|
||||
}
|
||||
return AsyncLROPoller[_models.DnsResolver](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
async def _update_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
parameters: Union[_models.DnsResolverPatch, IO],
|
||||
parameters: Union[_models.DnsResolverPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> Optional[_models.DnsResolver]:
|
||||
error_map = {
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -349,21 +313,19 @@ class DnsResolversOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[Optional[_models.DnsResolver]] = kwargs.pop("cls", None)
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IO, bytes)):
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "DnsResolverPatch")
|
||||
|
||||
request = build_update_request(
|
||||
_request = build_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
|
@ -372,35 +334,33 @@ class DnsResolversOperations:
|
|||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
template_url=self._update_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 202]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = None
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize("DnsResolver", pipeline_response)
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
_update_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
async def begin_update(
|
||||
|
@ -429,14 +389,6 @@ class DnsResolversOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolver or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolver]
|
||||
|
@ -448,7 +400,7 @@ class DnsResolversOperations:
|
|||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
parameters: IO,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
|
@ -462,7 +414,7 @@ class DnsResolversOperations:
|
|||
:param dns_resolver_name: The name of the DNS resolver. Required.
|
||||
:type dns_resolver_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Required.
|
||||
:type parameters: IO
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -470,14 +422,6 @@ class DnsResolversOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolver or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolver]
|
||||
|
@ -489,7 +433,7 @@ class DnsResolversOperations:
|
|||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
parameters: Union[_models.DnsResolverPatch, IO],
|
||||
parameters: Union[_models.DnsResolverPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsResolver]:
|
||||
|
@ -500,24 +444,13 @@ class DnsResolversOperations:
|
|||
:type resource_group_name: str
|
||||
:param dns_resolver_name: The name of the DNS resolver. Required.
|
||||
:type dns_resolver_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a model type or a IO
|
||||
type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsResolverPatch or IO
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a DnsResolverPatch
|
||||
type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsResolverPatch or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either DnsResolver or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolver]
|
||||
|
@ -526,9 +459,7 @@ class DnsResolversOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.DnsResolver] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
|
@ -547,12 +478,13 @@ class DnsResolversOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("DnsResolver", pipeline_response)
|
||||
deserialized = self._deserialize("DnsResolver", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
|
@ -562,22 +494,20 @@ class DnsResolversOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller.from_continuation_token(
|
||||
return AsyncLROPoller[_models.DnsResolver].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
return AsyncLROPoller[_models.DnsResolver](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
begin_update.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"
|
||||
}
|
||||
|
||||
async def _delete_initial( # pylint: disable=inconsistent-return-statements
|
||||
async def _delete_initial(
|
||||
self, resource_group_name: str, dns_resolver_name: str, if_match: Optional[str] = None, **kwargs: Any
|
||||
) -> None:
|
||||
error_map = {
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -588,40 +518,42 @@ class DnsResolversOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
request = build_delete_request(
|
||||
_request = build_delete_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
template_url=self._delete_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 202, 204]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
_delete_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"
|
||||
}
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace_async
|
||||
async def begin_delete(
|
||||
|
@ -638,14 +570,6 @@ class DnsResolversOperations:
|
|||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[None]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -653,15 +577,13 @@ class DnsResolversOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
||||
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
||||
if cont_token is None:
|
||||
raw_result = await self._delete_initial( # type: ignore
|
||||
raw_result = await self._delete_initial(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
if_match=if_match,
|
||||
|
@ -671,11 +593,12 @@ class DnsResolversOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
return cls(pipeline_response, None, {}) # type: ignore
|
||||
|
||||
if polling is True:
|
||||
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
|
||||
|
@ -684,17 +607,13 @@ class DnsResolversOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller.from_continuation_token(
|
||||
return AsyncLROPoller[None].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
begin_delete.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"
|
||||
}
|
||||
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
@distributed_trace_async
|
||||
async def get(self, resource_group_name: str, dns_resolver_name: str, **kwargs: Any) -> _models.DnsResolver:
|
||||
|
@ -705,12 +624,11 @@ class DnsResolversOperations:
|
|||
:type resource_group_name: str
|
||||
:param dns_resolver_name: The name of the DNS resolver. Required.
|
||||
:type dns_resolver_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: DnsResolver or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.DnsResolver
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -721,25 +639,22 @@ class DnsResolversOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.DnsResolver] = kwargs.pop("cls", None)
|
||||
|
||||
request = build_get_request(
|
||||
_request = build_get_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
api_version=api_version,
|
||||
template_url=self.get.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
@ -748,16 +663,12 @@ class DnsResolversOperations:
|
|||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = self._deserialize("DnsResolver", pipeline_response)
|
||||
deserialized = self._deserialize("DnsResolver", pipeline_response.http_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
get.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def list_by_resource_group(
|
||||
|
@ -771,7 +682,6 @@ class DnsResolversOperations:
|
|||
:param top: The maximum number of results to return. If not specified, returns up to 100
|
||||
results. Default value is None.
|
||||
:type top: int
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: An iterator like instance of either DnsResolver or the result of cls(response)
|
||||
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.DnsResolver]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -779,12 +689,10 @@ class DnsResolversOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.DnsResolverListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -795,17 +703,15 @@ class DnsResolversOperations:
|
|||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
request = build_list_by_resource_group_request(
|
||||
_request = build_list_by_resource_group_request(
|
||||
resource_group_name=resource_group_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
top=top,
|
||||
api_version=api_version,
|
||||
template_url=self.list_by_resource_group.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
|
@ -817,13 +723,12 @@ class DnsResolversOperations:
|
|||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
request = HttpRequest(
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
request.method = "GET"
|
||||
return request
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
async def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("DnsResolverListResult", pipeline_response)
|
||||
|
@ -833,10 +738,11 @@ class DnsResolversOperations:
|
|||
return deserialized.next_link or None, AsyncList(list_of_elem)
|
||||
|
||||
async def get_next(next_link=None):
|
||||
request = prepare_request(next_link)
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
|
@ -848,10 +754,6 @@ class DnsResolversOperations:
|
|||
|
||||
return AsyncItemPaged(get_next, extract_data)
|
||||
|
||||
list_by_resource_group.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers"
|
||||
}
|
||||
|
||||
@distributed_trace
|
||||
def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncIterable["_models.DnsResolver"]:
|
||||
"""Lists DNS resolvers in all resource groups of a subscription.
|
||||
|
@ -859,7 +761,6 @@ class DnsResolversOperations:
|
|||
:param top: The maximum number of results to return. If not specified, returns up to 100
|
||||
results. Default value is None.
|
||||
:type top: int
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: An iterator like instance of either DnsResolver or the result of cls(response)
|
||||
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.DnsResolver]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -867,12 +768,10 @@ class DnsResolversOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.DnsResolverListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -883,16 +782,14 @@ class DnsResolversOperations:
|
|||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
request = build_list_request(
|
||||
_request = build_list_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
top=top,
|
||||
api_version=api_version,
|
||||
template_url=self.list.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
|
@ -904,13 +801,12 @@ class DnsResolversOperations:
|
|||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
request = HttpRequest(
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
request.method = "GET"
|
||||
return request
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
async def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("DnsResolverListResult", pipeline_response)
|
||||
|
@ -920,10 +816,11 @@ class DnsResolversOperations:
|
|||
return deserialized.next_link or None, AsyncList(list_of_elem)
|
||||
|
||||
async def get_next(next_link=None):
|
||||
request = prepare_request(next_link)
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
|
@ -935,8 +832,6 @@ class DnsResolversOperations:
|
|||
|
||||
return AsyncItemPaged(get_next, extract_data)
|
||||
|
||||
list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolvers"}
|
||||
|
||||
@distributed_trace
|
||||
def list_by_virtual_network(
|
||||
self, resource_group_name: str, virtual_network_name: str, top: Optional[int] = None, **kwargs: Any
|
||||
|
@ -951,7 +846,6 @@ class DnsResolversOperations:
|
|||
:param top: The maximum number of results to return. If not specified, returns up to 100
|
||||
results. Default value is None.
|
||||
:type top: int
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: An iterator like instance of either SubResource or the result of cls(response)
|
||||
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.SubResource]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -959,12 +853,10 @@ class DnsResolversOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.SubResourceListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -975,18 +867,16 @@ class DnsResolversOperations:
|
|||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
request = build_list_by_virtual_network_request(
|
||||
_request = build_list_by_virtual_network_request(
|
||||
resource_group_name=resource_group_name,
|
||||
virtual_network_name=virtual_network_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
top=top,
|
||||
api_version=api_version,
|
||||
template_url=self.list_by_virtual_network.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
|
@ -998,13 +888,12 @@ class DnsResolversOperations:
|
|||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
request = HttpRequest(
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
request.method = "GET"
|
||||
return request
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
async def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("SubResourceListResult", pipeline_response)
|
||||
|
@ -1014,10 +903,11 @@ class DnsResolversOperations:
|
|||
return deserialized.next_link or None, AsyncList(list_of_elem)
|
||||
|
||||
async def get_next(next_link=None):
|
||||
request = prepare_request(next_link)
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
|
@ -1028,7 +918,3 @@ class DnsResolversOperations:
|
|||
return pipeline_response
|
||||
|
||||
return AsyncItemPaged(get_next, extract_data)
|
||||
|
||||
list_by_virtual_network.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listDnsResolvers"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,813 @@
|
|||
# pylint: disable=too-many-lines,too-many-statements
|
||||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
from io import IOBase
|
||||
import sys
|
||||
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
|
||||
import urllib.parse
|
||||
|
||||
from azure.core.async_paging import AsyncItemPaged, AsyncList
|
||||
from azure.core.exceptions import (
|
||||
ClientAuthenticationError,
|
||||
HttpResponseError,
|
||||
ResourceExistsError,
|
||||
ResourceNotFoundError,
|
||||
ResourceNotModifiedError,
|
||||
StreamClosedError,
|
||||
StreamConsumedError,
|
||||
map_error,
|
||||
)
|
||||
from azure.core.pipeline import PipelineResponse
|
||||
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
|
||||
from azure.core.rest import AsyncHttpResponse, HttpRequest
|
||||
from azure.core.tracing.decorator import distributed_trace
|
||||
from azure.core.tracing.decorator_async import distributed_trace_async
|
||||
from azure.core.utils import case_insensitive_dict
|
||||
from azure.mgmt.core.exceptions import ARMErrorFormat
|
||||
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
|
||||
|
||||
from ... import models as _models
|
||||
from ...operations._dns_security_rules_operations import (
|
||||
build_create_or_update_request,
|
||||
build_delete_request,
|
||||
build_get_request,
|
||||
build_list_request,
|
||||
build_update_request,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from collections.abc import MutableMapping
|
||||
else:
|
||||
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
|
||||
T = TypeVar("T")
|
||||
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
|
||||
|
||||
|
||||
class DnsSecurityRulesOperations:
|
||||
"""
|
||||
.. warning::
|
||||
**DO NOT** instantiate this class directly.
|
||||
|
||||
Instead, you should access the following operations through
|
||||
:class:`~azure.mgmt.dnsresolver.aio.DnsResolverManagementClient`'s
|
||||
:attr:`dns_security_rules` attribute.
|
||||
"""
|
||||
|
||||
models = _models
|
||||
|
||||
def __init__(self, *args, **kwargs) -> None:
|
||||
input_args = list(args)
|
||||
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
|
||||
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
|
||||
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
|
||||
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
|
||||
|
||||
async def _create_or_update_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_security_rule_name: str,
|
||||
parameters: Union[_models.DnsSecurityRule, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "DnsSecurityRule")
|
||||
|
||||
_request = build_create_or_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
dns_security_rule_name=dns_security_rule_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
if_none_match=if_none_match,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 201]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
async def begin_create_or_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_security_rule_name: str,
|
||||
parameters: _models.DnsSecurityRule,
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsSecurityRule]:
|
||||
"""Creates or updates a DNS security rule for a DNS resolver policy.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param dns_security_rule_name: The name of the DNS security rule. Required.
|
||||
:type dns_security_rule_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsSecurityRule
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsSecurityRule or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsSecurityRule]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
|
||||
@overload
|
||||
async def begin_create_or_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_security_rule_name: str,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsSecurityRule]:
|
||||
"""Creates or updates a DNS security rule for a DNS resolver policy.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param dns_security_rule_name: The name of the DNS security rule. Required.
|
||||
:type dns_security_rule_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Required.
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsSecurityRule or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsSecurityRule]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
|
||||
@distributed_trace_async
|
||||
async def begin_create_or_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_security_rule_name: str,
|
||||
parameters: Union[_models.DnsSecurityRule, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsSecurityRule]:
|
||||
"""Creates or updates a DNS security rule for a DNS resolver policy.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param dns_security_rule_name: The name of the DNS security rule. Required.
|
||||
:type dns_security_rule_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a
|
||||
DnsSecurityRule type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsSecurityRule or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsSecurityRule or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsSecurityRule]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.DnsSecurityRule] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
||||
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
||||
if cont_token is None:
|
||||
raw_result = await self._create_or_update_initial(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
dns_security_rule_name=dns_security_rule_name,
|
||||
parameters=parameters,
|
||||
if_match=if_match,
|
||||
if_none_match=if_none_match,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
cls=lambda x, y, z: x,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("DnsSecurityRule", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
|
||||
elif polling is False:
|
||||
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
|
||||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller[_models.DnsSecurityRule].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller[_models.DnsSecurityRule](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
async def _update_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_security_rule_name: str,
|
||||
parameters: Union[_models.DnsSecurityRulePatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "DnsSecurityRulePatch")
|
||||
|
||||
_request = build_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
dns_security_rule_name=dns_security_rule_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 202]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
response_headers = {}
|
||||
if response.status_code == 202:
|
||||
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
|
||||
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, response_headers) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
async def begin_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_security_rule_name: str,
|
||||
parameters: _models.DnsSecurityRulePatch,
|
||||
if_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsSecurityRule]:
|
||||
"""Updates a DNS security rule.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param dns_security_rule_name: The name of the DNS security rule. Required.
|
||||
:type dns_security_rule_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsSecurityRulePatch
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsSecurityRule or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsSecurityRule]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
|
||||
@overload
|
||||
async def begin_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_security_rule_name: str,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsSecurityRule]:
|
||||
"""Updates a DNS security rule.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param dns_security_rule_name: The name of the DNS security rule. Required.
|
||||
:type dns_security_rule_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Required.
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsSecurityRule or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsSecurityRule]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
|
||||
@distributed_trace_async
|
||||
async def begin_update(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_security_rule_name: str,
|
||||
parameters: Union[_models.DnsSecurityRulePatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.DnsSecurityRule]:
|
||||
"""Updates a DNS security rule.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param dns_security_rule_name: The name of the DNS security rule. Required.
|
||||
:type dns_security_rule_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a
|
||||
DnsSecurityRulePatch type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.DnsSecurityRulePatch or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:return: An instance of AsyncLROPoller that returns either DnsSecurityRule or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsSecurityRule]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.DnsSecurityRule] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
||||
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
||||
if cont_token is None:
|
||||
raw_result = await self._update_initial(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
dns_security_rule_name=dns_security_rule_name,
|
||||
parameters=parameters,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
cls=lambda x, y, z: x,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("DnsSecurityRule", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
|
||||
elif polling is False:
|
||||
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
|
||||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller[_models.DnsSecurityRule].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller[_models.DnsSecurityRule](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
async def _delete_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_security_rule_name: str,
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
_request = build_delete_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
dns_security_rule_name=dns_security_rule_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [202, 204]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
response_headers = {}
|
||||
if response.status_code == 202:
|
||||
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
|
||||
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, response_headers) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace_async
|
||||
async def begin_delete(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_policy_name: str,
|
||||
dns_security_rule_name: str,
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[None]:
|
||||
"""Deletes a DNS security rule for a DNS resolver policy. WARNING: This operation cannot be
|
||||
undone.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param dns_security_rule_name: The name of the DNS security rule. Required.
|
||||
:type dns_security_rule_name: str
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[None]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
||||
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
||||
if cont_token is None:
|
||||
raw_result = await self._delete_initial(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
dns_security_rule_name=dns_security_rule_name,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
cls=lambda x, y, z: x,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {}) # type: ignore
|
||||
|
||||
if polling is True:
|
||||
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
|
||||
elif polling is False:
|
||||
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
|
||||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller[None].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
@distributed_trace_async
|
||||
async def get(
|
||||
self, resource_group_name: str, dns_resolver_policy_name: str, dns_security_rule_name: str, **kwargs: Any
|
||||
) -> _models.DnsSecurityRule:
|
||||
"""Gets properties of a DNS security rule for a DNS resolver policy.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param dns_security_rule_name: The name of the DNS security rule. Required.
|
||||
:type dns_security_rule_name: str
|
||||
:return: DnsSecurityRule or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.DnsSecurityRule
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.DnsSecurityRule] = kwargs.pop("cls", None)
|
||||
|
||||
_request = build_get_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
dns_security_rule_name=dns_security_rule_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
api_version=api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = self._deserialize("DnsSecurityRule", pipeline_response.http_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def list(
|
||||
self, resource_group_name: str, dns_resolver_policy_name: str, top: Optional[int] = None, **kwargs: Any
|
||||
) -> AsyncIterable["_models.DnsSecurityRule"]:
|
||||
"""Lists DNS security rules for a DNS resolver policy.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
Required.
|
||||
:type resource_group_name: str
|
||||
:param dns_resolver_policy_name: The name of the DNS resolver policy. Required.
|
||||
:type dns_resolver_policy_name: str
|
||||
:param top: The maximum number of results to return. If not specified, returns up to 100
|
||||
results. Default value is None.
|
||||
:type top: int
|
||||
:return: An iterator like instance of either DnsSecurityRule or the result of cls(response)
|
||||
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.DnsSecurityRule]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.DnsSecurityRuleListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
304: ResourceNotModifiedError,
|
||||
}
|
||||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
_request = build_list_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_policy_name=dns_resolver_policy_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
top=top,
|
||||
api_version=api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
_parsed_next_link = urllib.parse.urlparse(next_link)
|
||||
_next_request_params = case_insensitive_dict(
|
||||
{
|
||||
key: [urllib.parse.quote(v) for v in value]
|
||||
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
|
||||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
async def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("DnsSecurityRuleListResult", pipeline_response)
|
||||
list_of_elem = deserialized.value
|
||||
if cls:
|
||||
list_of_elem = cls(list_of_elem) # type: ignore
|
||||
return deserialized.next_link or None, AsyncList(list_of_elem)
|
||||
|
||||
async def get_next(next_link=None):
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
||||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
||||
|
||||
return pipeline_response
|
||||
|
||||
return AsyncItemPaged(get_next, extract_data)
|
|
@ -1,4 +1,4 @@
|
|||
# pylint: disable=too-many-lines
|
||||
# pylint: disable=too-many-lines,too-many-statements
|
||||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
@ -6,8 +6,9 @@
|
|||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
from io import IOBase
|
||||
import sys
|
||||
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
|
||||
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
|
||||
import urllib.parse
|
||||
|
||||
from azure.core.async_paging import AsyncItemPaged, AsyncList
|
||||
|
@ -20,15 +21,13 @@ from azure.core.exceptions import (
|
|||
map_error,
|
||||
)
|
||||
from azure.core.pipeline import PipelineResponse
|
||||
from azure.core.pipeline.transport import AsyncHttpResponse
|
||||
from azure.core.rest import HttpRequest
|
||||
from azure.core.rest import AsyncHttpResponse, HttpRequest
|
||||
from azure.core.tracing.decorator import distributed_trace
|
||||
from azure.core.tracing.decorator_async import distributed_trace_async
|
||||
from azure.core.utils import case_insensitive_dict
|
||||
from azure.mgmt.core.exceptions import ARMErrorFormat
|
||||
|
||||
from ... import models as _models
|
||||
from ..._vendor import _convert_request
|
||||
from ...operations._forwarding_rules_operations import (
|
||||
build_create_or_update_request,
|
||||
build_delete_request,
|
||||
|
@ -37,10 +36,10 @@ from ...operations._forwarding_rules_operations import (
|
|||
build_update_request,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
|
||||
if sys.version_info >= (3, 9):
|
||||
from collections.abc import MutableMapping
|
||||
else:
|
||||
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
|
||||
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
|
||||
T = TypeVar("T")
|
||||
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
|
||||
|
||||
|
@ -98,7 +97,6 @@ class ForwardingRulesOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: ForwardingRule or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.ForwardingRule
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -110,7 +108,7 @@ class ForwardingRulesOperations:
|
|||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
forwarding_rule_name: str,
|
||||
parameters: IO,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
*,
|
||||
|
@ -127,7 +125,7 @@ class ForwardingRulesOperations:
|
|||
:param forwarding_rule_name: The name of the forwarding rule. Required.
|
||||
:type forwarding_rule_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Required.
|
||||
:type parameters: IO
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -138,7 +136,6 @@ class ForwardingRulesOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: ForwardingRule or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.ForwardingRule
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -150,7 +147,7 @@ class ForwardingRulesOperations:
|
|||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
forwarding_rule_name: str,
|
||||
parameters: Union[_models.ForwardingRule, IO],
|
||||
parameters: Union[_models.ForwardingRule, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
|
@ -164,9 +161,9 @@ class ForwardingRulesOperations:
|
|||
:type dns_forwarding_ruleset_name: str
|
||||
:param forwarding_rule_name: The name of the forwarding rule. Required.
|
||||
:type forwarding_rule_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a model type
|
||||
or a IO type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.ForwardingRule or IO
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a
|
||||
ForwardingRule type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.ForwardingRule or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -174,15 +171,11 @@ class ForwardingRulesOperations:
|
|||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: ForwardingRule or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.ForwardingRule
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -193,21 +186,19 @@ class ForwardingRulesOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.ForwardingRule] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IO, bytes)):
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "ForwardingRule")
|
||||
|
||||
request = build_create_or_update_request(
|
||||
_request = build_create_or_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
forwarding_rule_name=forwarding_rule_name,
|
||||
|
@ -218,15 +209,14 @@ class ForwardingRulesOperations:
|
|||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
template_url=self.create_or_update.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
@ -235,21 +225,13 @@ class ForwardingRulesOperations:
|
|||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize("ForwardingRule", pipeline_response)
|
||||
|
||||
if response.status_code == 201:
|
||||
deserialized = self._deserialize("ForwardingRule", pipeline_response)
|
||||
deserialized = self._deserialize("ForwardingRule", pipeline_response.http_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
create_or_update.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}"
|
||||
}
|
||||
|
||||
@overload
|
||||
async def update(
|
||||
self,
|
||||
|
@ -280,7 +262,6 @@ class ForwardingRulesOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: ForwardingRule or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.ForwardingRule
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -292,7 +273,7 @@ class ForwardingRulesOperations:
|
|||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
forwarding_rule_name: str,
|
||||
parameters: IO,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
|
@ -308,7 +289,7 @@ class ForwardingRulesOperations:
|
|||
:param forwarding_rule_name: The name of the forwarding rule. Required.
|
||||
:type forwarding_rule_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Required.
|
||||
:type parameters: IO
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -316,7 +297,6 @@ class ForwardingRulesOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: ForwardingRule or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.ForwardingRule
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -328,7 +308,7 @@ class ForwardingRulesOperations:
|
|||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
forwarding_rule_name: str,
|
||||
parameters: Union[_models.ForwardingRulePatch, IO],
|
||||
parameters: Union[_models.ForwardingRulePatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> _models.ForwardingRule:
|
||||
|
@ -341,22 +321,18 @@ class ForwardingRulesOperations:
|
|||
:type dns_forwarding_ruleset_name: str
|
||||
:param forwarding_rule_name: The name of the forwarding rule. Required.
|
||||
:type forwarding_rule_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a model type or a IO
|
||||
type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.ForwardingRulePatch or IO
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a ForwardingRulePatch
|
||||
type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.ForwardingRulePatch or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: ForwardingRule or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.ForwardingRule
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -367,21 +343,19 @@ class ForwardingRulesOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.ForwardingRule] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IO, bytes)):
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "ForwardingRulePatch")
|
||||
|
||||
request = build_update_request(
|
||||
_request = build_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
forwarding_rule_name=forwarding_rule_name,
|
||||
|
@ -391,15 +365,14 @@ class ForwardingRulesOperations:
|
|||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
template_url=self.update.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
@ -408,16 +381,12 @@ class ForwardingRulesOperations:
|
|||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = self._deserialize("ForwardingRule", pipeline_response)
|
||||
deserialized = self._deserialize("ForwardingRule", pipeline_response.http_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
update.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace_async
|
||||
async def delete( # pylint: disable=inconsistent-return-statements
|
||||
|
@ -442,12 +411,11 @@ class ForwardingRulesOperations:
|
|||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: None or the result of cls(response)
|
||||
:rtype: None
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -458,27 +426,24 @@ class ForwardingRulesOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
|
||||
request = build_delete_request(
|
||||
_request = build_delete_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
forwarding_rule_name=forwarding_rule_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
template_url=self.delete.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
@ -488,11 +453,7 @@ class ForwardingRulesOperations:
|
|||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
|
||||
delete.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}"
|
||||
}
|
||||
return cls(pipeline_response, None, {}) # type: ignore
|
||||
|
||||
@distributed_trace_async
|
||||
async def get(
|
||||
|
@ -507,12 +468,11 @@ class ForwardingRulesOperations:
|
|||
:type dns_forwarding_ruleset_name: str
|
||||
:param forwarding_rule_name: The name of the forwarding rule. Required.
|
||||
:type forwarding_rule_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: ForwardingRule or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.ForwardingRule
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -523,26 +483,23 @@ class ForwardingRulesOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.ForwardingRule] = kwargs.pop("cls", None)
|
||||
|
||||
request = build_get_request(
|
||||
_request = build_get_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
forwarding_rule_name=forwarding_rule_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
api_version=api_version,
|
||||
template_url=self.get.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
@ -551,16 +508,12 @@ class ForwardingRulesOperations:
|
|||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = self._deserialize("ForwardingRule", pipeline_response)
|
||||
deserialized = self._deserialize("ForwardingRule", pipeline_response.http_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
get.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def list(
|
||||
|
@ -576,7 +529,6 @@ class ForwardingRulesOperations:
|
|||
:param top: The maximum number of results to return. If not specified, returns up to 100
|
||||
results. Default value is None.
|
||||
:type top: int
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: An iterator like instance of either ForwardingRule or the result of cls(response)
|
||||
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.ForwardingRule]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -584,12 +536,10 @@ class ForwardingRulesOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.ForwardingRuleListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -600,18 +550,16 @@ class ForwardingRulesOperations:
|
|||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
request = build_list_request(
|
||||
_request = build_list_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
top=top,
|
||||
api_version=api_version,
|
||||
template_url=self.list.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
|
@ -623,13 +571,12 @@ class ForwardingRulesOperations:
|
|||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
request = HttpRequest(
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
request.method = "GET"
|
||||
return request
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
async def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("ForwardingRuleListResult", pipeline_response)
|
||||
|
@ -639,10 +586,11 @@ class ForwardingRulesOperations:
|
|||
return deserialized.next_link or None, AsyncList(list_of_elem)
|
||||
|
||||
async def get_next(next_link=None):
|
||||
request = prepare_request(next_link)
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
|
@ -653,7 +601,3 @@ class ForwardingRulesOperations:
|
|||
return pipeline_response
|
||||
|
||||
return AsyncItemPaged(get_next, extract_data)
|
||||
|
||||
list.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules"
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# pylint: disable=too-many-lines
|
||||
# pylint: disable=too-many-lines,too-many-statements
|
||||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
@ -6,8 +6,9 @@
|
|||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
from io import IOBase
|
||||
import sys
|
||||
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
|
||||
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
|
||||
import urllib.parse
|
||||
|
||||
from azure.core.async_paging import AsyncItemPaged, AsyncList
|
||||
|
@ -17,12 +18,13 @@ from azure.core.exceptions import (
|
|||
ResourceExistsError,
|
||||
ResourceNotFoundError,
|
||||
ResourceNotModifiedError,
|
||||
StreamClosedError,
|
||||
StreamConsumedError,
|
||||
map_error,
|
||||
)
|
||||
from azure.core.pipeline import PipelineResponse
|
||||
from azure.core.pipeline.transport import AsyncHttpResponse
|
||||
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
|
||||
from azure.core.rest import HttpRequest
|
||||
from azure.core.rest import AsyncHttpResponse, HttpRequest
|
||||
from azure.core.tracing.decorator import distributed_trace
|
||||
from azure.core.tracing.decorator_async import distributed_trace_async
|
||||
from azure.core.utils import case_insensitive_dict
|
||||
|
@ -30,7 +32,6 @@ from azure.mgmt.core.exceptions import ARMErrorFormat
|
|||
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
|
||||
|
||||
from ... import models as _models
|
||||
from ..._vendor import _convert_request
|
||||
from ...operations._inbound_endpoints_operations import (
|
||||
build_create_or_update_request,
|
||||
build_delete_request,
|
||||
|
@ -39,10 +40,10 @@ from ...operations._inbound_endpoints_operations import (
|
|||
build_update_request,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
|
||||
if sys.version_info >= (3, 9):
|
||||
from collections.abc import MutableMapping
|
||||
else:
|
||||
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
|
||||
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
|
||||
T = TypeVar("T")
|
||||
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
|
||||
|
||||
|
@ -71,12 +72,12 @@ class InboundEndpointsOperations:
|
|||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
inbound_endpoint_name: str,
|
||||
parameters: Union[_models.InboundEndpoint, IO],
|
||||
parameters: Union[_models.InboundEndpoint, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> Optional[_models.InboundEndpoint]:
|
||||
error_map = {
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -87,21 +88,19 @@ class InboundEndpointsOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[Optional[_models.InboundEndpoint]] = kwargs.pop("cls", None)
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IO, bytes)):
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "InboundEndpoint")
|
||||
|
||||
request = build_create_or_update_request(
|
||||
_request = build_create_or_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
inbound_endpoint_name=inbound_endpoint_name,
|
||||
|
@ -112,38 +111,33 @@ class InboundEndpointsOperations:
|
|||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
template_url=self._create_or_update_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 201, 202]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = None
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize("InboundEndpoint", pipeline_response)
|
||||
|
||||
if response.status_code == 201:
|
||||
deserialized = self._deserialize("InboundEndpoint", pipeline_response)
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
_create_or_update_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
async def begin_create_or_update(
|
||||
|
@ -179,14 +173,6 @@ class InboundEndpointsOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either InboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.InboundEndpoint]
|
||||
|
@ -199,7 +185,7 @@ class InboundEndpointsOperations:
|
|||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
inbound_endpoint_name: str,
|
||||
parameters: IO,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
*,
|
||||
|
@ -216,7 +202,7 @@ class InboundEndpointsOperations:
|
|||
:param inbound_endpoint_name: The name of the inbound endpoint for the DNS resolver. Required.
|
||||
:type inbound_endpoint_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Required.
|
||||
:type parameters: IO
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -227,14 +213,6 @@ class InboundEndpointsOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either InboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.InboundEndpoint]
|
||||
|
@ -247,7 +225,7 @@ class InboundEndpointsOperations:
|
|||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
inbound_endpoint_name: str,
|
||||
parameters: Union[_models.InboundEndpoint, IO],
|
||||
parameters: Union[_models.InboundEndpoint, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
|
@ -261,9 +239,9 @@ class InboundEndpointsOperations:
|
|||
:type dns_resolver_name: str
|
||||
:param inbound_endpoint_name: The name of the inbound endpoint for the DNS resolver. Required.
|
||||
:type inbound_endpoint_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a model type
|
||||
or a IO type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.InboundEndpoint or IO
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a
|
||||
InboundEndpoint type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.InboundEndpoint or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -271,17 +249,6 @@ class InboundEndpointsOperations:
|
|||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either InboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.InboundEndpoint]
|
||||
|
@ -290,9 +257,7 @@ class InboundEndpointsOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.InboundEndpoint] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
|
@ -313,12 +278,13 @@ class InboundEndpointsOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("InboundEndpoint", pipeline_response)
|
||||
deserialized = self._deserialize("InboundEndpoint", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
|
@ -328,28 +294,26 @@ class InboundEndpointsOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller.from_continuation_token(
|
||||
return AsyncLROPoller[_models.InboundEndpoint].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
begin_create_or_update.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"
|
||||
}
|
||||
return AsyncLROPoller[_models.InboundEndpoint](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
async def _update_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
inbound_endpoint_name: str,
|
||||
parameters: Union[_models.InboundEndpointPatch, IO],
|
||||
parameters: Union[_models.InboundEndpointPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> Optional[_models.InboundEndpoint]:
|
||||
error_map = {
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -360,21 +324,19 @@ class InboundEndpointsOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[Optional[_models.InboundEndpoint]] = kwargs.pop("cls", None)
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IO, bytes)):
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "InboundEndpointPatch")
|
||||
|
||||
request = build_update_request(
|
||||
_request = build_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
inbound_endpoint_name=inbound_endpoint_name,
|
||||
|
@ -384,35 +346,33 @@ class InboundEndpointsOperations:
|
|||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
template_url=self._update_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 202]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = None
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize("InboundEndpoint", pipeline_response)
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
_update_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
async def begin_update(
|
||||
|
@ -444,14 +404,6 @@ class InboundEndpointsOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either InboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.InboundEndpoint]
|
||||
|
@ -464,7 +416,7 @@ class InboundEndpointsOperations:
|
|||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
inbound_endpoint_name: str,
|
||||
parameters: IO,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
|
@ -480,7 +432,7 @@ class InboundEndpointsOperations:
|
|||
:param inbound_endpoint_name: The name of the inbound endpoint for the DNS resolver. Required.
|
||||
:type inbound_endpoint_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Required.
|
||||
:type parameters: IO
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -488,14 +440,6 @@ class InboundEndpointsOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either InboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.InboundEndpoint]
|
||||
|
@ -508,7 +452,7 @@ class InboundEndpointsOperations:
|
|||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
inbound_endpoint_name: str,
|
||||
parameters: Union[_models.InboundEndpointPatch, IO],
|
||||
parameters: Union[_models.InboundEndpointPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.InboundEndpoint]:
|
||||
|
@ -521,24 +465,13 @@ class InboundEndpointsOperations:
|
|||
:type dns_resolver_name: str
|
||||
:param inbound_endpoint_name: The name of the inbound endpoint for the DNS resolver. Required.
|
||||
:type inbound_endpoint_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a model type or a IO
|
||||
type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.InboundEndpointPatch or IO
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a
|
||||
InboundEndpointPatch type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.InboundEndpointPatch or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either InboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.InboundEndpoint]
|
||||
|
@ -547,9 +480,7 @@ class InboundEndpointsOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.InboundEndpoint] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
|
@ -569,12 +500,13 @@ class InboundEndpointsOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("InboundEndpoint", pipeline_response)
|
||||
deserialized = self._deserialize("InboundEndpoint", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
|
@ -584,27 +516,25 @@ class InboundEndpointsOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller.from_continuation_token(
|
||||
return AsyncLROPoller[_models.InboundEndpoint].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
return AsyncLROPoller[_models.InboundEndpoint](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
begin_update.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"
|
||||
}
|
||||
|
||||
async def _delete_initial( # pylint: disable=inconsistent-return-statements
|
||||
async def _delete_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
inbound_endpoint_name: str,
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> None:
|
||||
error_map = {
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -615,41 +545,43 @@ class InboundEndpointsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
request = build_delete_request(
|
||||
_request = build_delete_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
inbound_endpoint_name=inbound_endpoint_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
template_url=self._delete_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 202, 204]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
_delete_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"
|
||||
}
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace_async
|
||||
async def begin_delete(
|
||||
|
@ -673,14 +605,6 @@ class InboundEndpointsOperations:
|
|||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[None]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -688,15 +612,13 @@ class InboundEndpointsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
||||
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
||||
if cont_token is None:
|
||||
raw_result = await self._delete_initial( # type: ignore
|
||||
raw_result = await self._delete_initial(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
inbound_endpoint_name=inbound_endpoint_name,
|
||||
|
@ -707,11 +629,12 @@ class InboundEndpointsOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
return cls(pipeline_response, None, {}) # type: ignore
|
||||
|
||||
if polling is True:
|
||||
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
|
||||
|
@ -720,17 +643,13 @@ class InboundEndpointsOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller.from_continuation_token(
|
||||
return AsyncLROPoller[None].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
begin_delete.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"
|
||||
}
|
||||
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
@distributed_trace_async
|
||||
async def get(
|
||||
|
@ -745,12 +664,11 @@ class InboundEndpointsOperations:
|
|||
:type dns_resolver_name: str
|
||||
:param inbound_endpoint_name: The name of the inbound endpoint for the DNS resolver. Required.
|
||||
:type inbound_endpoint_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: InboundEndpoint or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.InboundEndpoint
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -761,26 +679,23 @@ class InboundEndpointsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.InboundEndpoint] = kwargs.pop("cls", None)
|
||||
|
||||
request = build_get_request(
|
||||
_request = build_get_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
inbound_endpoint_name=inbound_endpoint_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
api_version=api_version,
|
||||
template_url=self.get.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
@ -789,16 +704,12 @@ class InboundEndpointsOperations:
|
|||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = self._deserialize("InboundEndpoint", pipeline_response)
|
||||
deserialized = self._deserialize("InboundEndpoint", pipeline_response.http_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
get.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def list(
|
||||
|
@ -814,7 +725,6 @@ class InboundEndpointsOperations:
|
|||
:param top: The maximum number of results to return. If not specified, returns up to 100
|
||||
results. Default value is None.
|
||||
:type top: int
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: An iterator like instance of either InboundEndpoint or the result of cls(response)
|
||||
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.InboundEndpoint]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -822,12 +732,10 @@ class InboundEndpointsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.InboundEndpointListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -838,18 +746,16 @@ class InboundEndpointsOperations:
|
|||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
request = build_list_request(
|
||||
_request = build_list_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
top=top,
|
||||
api_version=api_version,
|
||||
template_url=self.list.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
|
@ -861,13 +767,12 @@ class InboundEndpointsOperations:
|
|||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
request = HttpRequest(
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
request.method = "GET"
|
||||
return request
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
async def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("InboundEndpointListResult", pipeline_response)
|
||||
|
@ -877,10 +782,11 @@ class InboundEndpointsOperations:
|
|||
return deserialized.next_link or None, AsyncList(list_of_elem)
|
||||
|
||||
async def get_next(next_link=None):
|
||||
request = prepare_request(next_link)
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
|
@ -891,7 +797,3 @@ class InboundEndpointsOperations:
|
|||
return pipeline_response
|
||||
|
||||
return AsyncItemPaged(get_next, extract_data)
|
||||
|
||||
list.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints"
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# pylint: disable=too-many-lines
|
||||
# pylint: disable=too-many-lines,too-many-statements
|
||||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
@ -6,8 +6,9 @@
|
|||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
from io import IOBase
|
||||
import sys
|
||||
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
|
||||
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
|
||||
import urllib.parse
|
||||
|
||||
from azure.core.async_paging import AsyncItemPaged, AsyncList
|
||||
|
@ -17,12 +18,13 @@ from azure.core.exceptions import (
|
|||
ResourceExistsError,
|
||||
ResourceNotFoundError,
|
||||
ResourceNotModifiedError,
|
||||
StreamClosedError,
|
||||
StreamConsumedError,
|
||||
map_error,
|
||||
)
|
||||
from azure.core.pipeline import PipelineResponse
|
||||
from azure.core.pipeline.transport import AsyncHttpResponse
|
||||
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
|
||||
from azure.core.rest import HttpRequest
|
||||
from azure.core.rest import AsyncHttpResponse, HttpRequest
|
||||
from azure.core.tracing.decorator import distributed_trace
|
||||
from azure.core.tracing.decorator_async import distributed_trace_async
|
||||
from azure.core.utils import case_insensitive_dict
|
||||
|
@ -30,7 +32,6 @@ from azure.mgmt.core.exceptions import ARMErrorFormat
|
|||
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
|
||||
|
||||
from ... import models as _models
|
||||
from ..._vendor import _convert_request
|
||||
from ...operations._outbound_endpoints_operations import (
|
||||
build_create_or_update_request,
|
||||
build_delete_request,
|
||||
|
@ -39,10 +40,10 @@ from ...operations._outbound_endpoints_operations import (
|
|||
build_update_request,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
|
||||
if sys.version_info >= (3, 9):
|
||||
from collections.abc import MutableMapping
|
||||
else:
|
||||
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
|
||||
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
|
||||
T = TypeVar("T")
|
||||
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
|
||||
|
||||
|
@ -71,12 +72,12 @@ class OutboundEndpointsOperations:
|
|||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
outbound_endpoint_name: str,
|
||||
parameters: Union[_models.OutboundEndpoint, IO],
|
||||
parameters: Union[_models.OutboundEndpoint, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> Optional[_models.OutboundEndpoint]:
|
||||
error_map = {
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -87,21 +88,19 @@ class OutboundEndpointsOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[Optional[_models.OutboundEndpoint]] = kwargs.pop("cls", None)
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IO, bytes)):
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "OutboundEndpoint")
|
||||
|
||||
request = build_create_or_update_request(
|
||||
_request = build_create_or_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
outbound_endpoint_name=outbound_endpoint_name,
|
||||
|
@ -112,38 +111,33 @@ class OutboundEndpointsOperations:
|
|||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
template_url=self._create_or_update_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 201, 202]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = None
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize("OutboundEndpoint", pipeline_response)
|
||||
|
||||
if response.status_code == 201:
|
||||
deserialized = self._deserialize("OutboundEndpoint", pipeline_response)
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
_create_or_update_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
async def begin_create_or_update(
|
||||
|
@ -180,14 +174,6 @@ class OutboundEndpointsOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either OutboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.OutboundEndpoint]
|
||||
|
@ -200,7 +186,7 @@ class OutboundEndpointsOperations:
|
|||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
outbound_endpoint_name: str,
|
||||
parameters: IO,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
*,
|
||||
|
@ -218,7 +204,7 @@ class OutboundEndpointsOperations:
|
|||
Required.
|
||||
:type outbound_endpoint_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Required.
|
||||
:type parameters: IO
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -229,14 +215,6 @@ class OutboundEndpointsOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either OutboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.OutboundEndpoint]
|
||||
|
@ -249,7 +227,7 @@ class OutboundEndpointsOperations:
|
|||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
outbound_endpoint_name: str,
|
||||
parameters: Union[_models.OutboundEndpoint, IO],
|
||||
parameters: Union[_models.OutboundEndpoint, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
|
@ -264,9 +242,9 @@ class OutboundEndpointsOperations:
|
|||
:param outbound_endpoint_name: The name of the outbound endpoint for the DNS resolver.
|
||||
Required.
|
||||
:type outbound_endpoint_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a model type
|
||||
or a IO type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.OutboundEndpoint or IO
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a
|
||||
OutboundEndpoint type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.OutboundEndpoint or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -274,17 +252,6 @@ class OutboundEndpointsOperations:
|
|||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either OutboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.OutboundEndpoint]
|
||||
|
@ -293,9 +260,7 @@ class OutboundEndpointsOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.OutboundEndpoint] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
|
@ -316,12 +281,13 @@ class OutboundEndpointsOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("OutboundEndpoint", pipeline_response)
|
||||
deserialized = self._deserialize("OutboundEndpoint", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
|
@ -331,28 +297,26 @@ class OutboundEndpointsOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller.from_continuation_token(
|
||||
return AsyncLROPoller[_models.OutboundEndpoint].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
begin_create_or_update.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"
|
||||
}
|
||||
return AsyncLROPoller[_models.OutboundEndpoint](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
async def _update_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
outbound_endpoint_name: str,
|
||||
parameters: Union[_models.OutboundEndpointPatch, IO],
|
||||
parameters: Union[_models.OutboundEndpointPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> Optional[_models.OutboundEndpoint]:
|
||||
error_map = {
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -363,21 +327,19 @@ class OutboundEndpointsOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[Optional[_models.OutboundEndpoint]] = kwargs.pop("cls", None)
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IO, bytes)):
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "OutboundEndpointPatch")
|
||||
|
||||
request = build_update_request(
|
||||
_request = build_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
outbound_endpoint_name=outbound_endpoint_name,
|
||||
|
@ -387,35 +349,33 @@ class OutboundEndpointsOperations:
|
|||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
template_url=self._update_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 202]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = None
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize("OutboundEndpoint", pipeline_response)
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
_update_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
async def begin_update(
|
||||
|
@ -448,14 +408,6 @@ class OutboundEndpointsOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either OutboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.OutboundEndpoint]
|
||||
|
@ -468,7 +420,7 @@ class OutboundEndpointsOperations:
|
|||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
outbound_endpoint_name: str,
|
||||
parameters: IO,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
|
@ -485,7 +437,7 @@ class OutboundEndpointsOperations:
|
|||
Required.
|
||||
:type outbound_endpoint_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Required.
|
||||
:type parameters: IO
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -493,14 +445,6 @@ class OutboundEndpointsOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either OutboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.OutboundEndpoint]
|
||||
|
@ -513,7 +457,7 @@ class OutboundEndpointsOperations:
|
|||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
outbound_endpoint_name: str,
|
||||
parameters: Union[_models.OutboundEndpointPatch, IO],
|
||||
parameters: Union[_models.OutboundEndpointPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.OutboundEndpoint]:
|
||||
|
@ -527,24 +471,13 @@ class OutboundEndpointsOperations:
|
|||
:param outbound_endpoint_name: The name of the outbound endpoint for the DNS resolver.
|
||||
Required.
|
||||
:type outbound_endpoint_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a model type or a IO
|
||||
type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.OutboundEndpointPatch or IO
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a
|
||||
OutboundEndpointPatch type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.OutboundEndpointPatch or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either OutboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.OutboundEndpoint]
|
||||
|
@ -553,9 +486,7 @@ class OutboundEndpointsOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.OutboundEndpoint] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
|
@ -575,12 +506,13 @@ class OutboundEndpointsOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("OutboundEndpoint", pipeline_response)
|
||||
deserialized = self._deserialize("OutboundEndpoint", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
|
@ -590,27 +522,25 @@ class OutboundEndpointsOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller.from_continuation_token(
|
||||
return AsyncLROPoller[_models.OutboundEndpoint].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
return AsyncLROPoller[_models.OutboundEndpoint](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
begin_update.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"
|
||||
}
|
||||
|
||||
async def _delete_initial( # pylint: disable=inconsistent-return-statements
|
||||
async def _delete_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
outbound_endpoint_name: str,
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> None:
|
||||
error_map = {
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -621,41 +551,43 @@ class OutboundEndpointsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
request = build_delete_request(
|
||||
_request = build_delete_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
outbound_endpoint_name=outbound_endpoint_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
template_url=self._delete_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 202, 204]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
_delete_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"
|
||||
}
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace_async
|
||||
async def begin_delete(
|
||||
|
@ -680,14 +612,6 @@ class OutboundEndpointsOperations:
|
|||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[None]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -695,15 +619,13 @@ class OutboundEndpointsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
||||
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
||||
if cont_token is None:
|
||||
raw_result = await self._delete_initial( # type: ignore
|
||||
raw_result = await self._delete_initial(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
outbound_endpoint_name=outbound_endpoint_name,
|
||||
|
@ -714,11 +636,12 @@ class OutboundEndpointsOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
return cls(pipeline_response, None, {}) # type: ignore
|
||||
|
||||
if polling is True:
|
||||
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
|
||||
|
@ -727,17 +650,13 @@ class OutboundEndpointsOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller.from_continuation_token(
|
||||
return AsyncLROPoller[None].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
begin_delete.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"
|
||||
}
|
||||
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
@distributed_trace_async
|
||||
async def get(
|
||||
|
@ -753,12 +672,11 @@ class OutboundEndpointsOperations:
|
|||
:param outbound_endpoint_name: The name of the outbound endpoint for the DNS resolver.
|
||||
Required.
|
||||
:type outbound_endpoint_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: OutboundEndpoint or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.OutboundEndpoint
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -769,26 +687,23 @@ class OutboundEndpointsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.OutboundEndpoint] = kwargs.pop("cls", None)
|
||||
|
||||
request = build_get_request(
|
||||
_request = build_get_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
outbound_endpoint_name=outbound_endpoint_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
api_version=api_version,
|
||||
template_url=self.get.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
@ -797,16 +712,12 @@ class OutboundEndpointsOperations:
|
|||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = self._deserialize("OutboundEndpoint", pipeline_response)
|
||||
deserialized = self._deserialize("OutboundEndpoint", pipeline_response.http_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
get.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def list(
|
||||
|
@ -822,7 +733,6 @@ class OutboundEndpointsOperations:
|
|||
:param top: The maximum number of results to return. If not specified, returns up to 100
|
||||
results. Default value is None.
|
||||
:type top: int
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: An iterator like instance of either OutboundEndpoint or the result of cls(response)
|
||||
:rtype:
|
||||
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.OutboundEndpoint]
|
||||
|
@ -831,12 +741,10 @@ class OutboundEndpointsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.OutboundEndpointListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -847,18 +755,16 @@ class OutboundEndpointsOperations:
|
|||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
request = build_list_request(
|
||||
_request = build_list_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
top=top,
|
||||
api_version=api_version,
|
||||
template_url=self.list.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
|
@ -870,13 +776,12 @@ class OutboundEndpointsOperations:
|
|||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
request = HttpRequest(
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
request.method = "GET"
|
||||
return request
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
async def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("OutboundEndpointListResult", pipeline_response)
|
||||
|
@ -886,10 +791,11 @@ class OutboundEndpointsOperations:
|
|||
return deserialized.next_link or None, AsyncList(list_of_elem)
|
||||
|
||||
async def get_next(next_link=None):
|
||||
request = prepare_request(next_link)
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
|
@ -900,7 +806,3 @@ class OutboundEndpointsOperations:
|
|||
return pipeline_response
|
||||
|
||||
return AsyncItemPaged(get_next, extract_data)
|
||||
|
||||
list.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints"
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# pylint: disable=too-many-lines
|
||||
# pylint: disable=too-many-lines,too-many-statements
|
||||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
@ -6,8 +6,9 @@
|
|||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
from io import IOBase
|
||||
import sys
|
||||
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
|
||||
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
|
||||
import urllib.parse
|
||||
|
||||
from azure.core.async_paging import AsyncItemPaged, AsyncList
|
||||
|
@ -17,12 +18,13 @@ from azure.core.exceptions import (
|
|||
ResourceExistsError,
|
||||
ResourceNotFoundError,
|
||||
ResourceNotModifiedError,
|
||||
StreamClosedError,
|
||||
StreamConsumedError,
|
||||
map_error,
|
||||
)
|
||||
from azure.core.pipeline import PipelineResponse
|
||||
from azure.core.pipeline.transport import AsyncHttpResponse
|
||||
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
|
||||
from azure.core.rest import HttpRequest
|
||||
from azure.core.rest import AsyncHttpResponse, HttpRequest
|
||||
from azure.core.tracing.decorator import distributed_trace
|
||||
from azure.core.tracing.decorator_async import distributed_trace_async
|
||||
from azure.core.utils import case_insensitive_dict
|
||||
|
@ -30,7 +32,6 @@ from azure.mgmt.core.exceptions import ARMErrorFormat
|
|||
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
|
||||
|
||||
from ... import models as _models
|
||||
from ..._vendor import _convert_request
|
||||
from ...operations._virtual_network_links_operations import (
|
||||
build_create_or_update_request,
|
||||
build_delete_request,
|
||||
|
@ -39,10 +40,10 @@ from ...operations._virtual_network_links_operations import (
|
|||
build_update_request,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
|
||||
if sys.version_info >= (3, 9):
|
||||
from collections.abc import MutableMapping
|
||||
else:
|
||||
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
|
||||
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
|
||||
T = TypeVar("T")
|
||||
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
|
||||
|
||||
|
@ -71,12 +72,12 @@ class VirtualNetworkLinksOperations:
|
|||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
virtual_network_link_name: str,
|
||||
parameters: Union[_models.VirtualNetworkLink, IO],
|
||||
parameters: Union[_models.VirtualNetworkLink, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> Optional[_models.VirtualNetworkLink]:
|
||||
error_map = {
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -87,21 +88,19 @@ class VirtualNetworkLinksOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[Optional[_models.VirtualNetworkLink]] = kwargs.pop("cls", None)
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IO, bytes)):
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "VirtualNetworkLink")
|
||||
|
||||
request = build_create_or_update_request(
|
||||
_request = build_create_or_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
virtual_network_link_name=virtual_network_link_name,
|
||||
|
@ -112,38 +111,33 @@ class VirtualNetworkLinksOperations:
|
|||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
template_url=self._create_or_update_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 201, 202]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = None
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize("VirtualNetworkLink", pipeline_response)
|
||||
|
||||
if response.status_code == 201:
|
||||
deserialized = self._deserialize("VirtualNetworkLink", pipeline_response)
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
_create_or_update_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
async def begin_create_or_update(
|
||||
|
@ -179,14 +173,6 @@ class VirtualNetworkLinksOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either VirtualNetworkLink or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.VirtualNetworkLink]
|
||||
|
@ -199,7 +185,7 @@ class VirtualNetworkLinksOperations:
|
|||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
virtual_network_link_name: str,
|
||||
parameters: IO,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
*,
|
||||
|
@ -216,7 +202,7 @@ class VirtualNetworkLinksOperations:
|
|||
:param virtual_network_link_name: The name of the virtual network link. Required.
|
||||
:type virtual_network_link_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Required.
|
||||
:type parameters: IO
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -227,14 +213,6 @@ class VirtualNetworkLinksOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either VirtualNetworkLink or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.VirtualNetworkLink]
|
||||
|
@ -247,7 +225,7 @@ class VirtualNetworkLinksOperations:
|
|||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
virtual_network_link_name: str,
|
||||
parameters: Union[_models.VirtualNetworkLink, IO],
|
||||
parameters: Union[_models.VirtualNetworkLink, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
|
@ -261,9 +239,9 @@ class VirtualNetworkLinksOperations:
|
|||
:type dns_forwarding_ruleset_name: str
|
||||
:param virtual_network_link_name: The name of the virtual network link. Required.
|
||||
:type virtual_network_link_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a model type
|
||||
or a IO type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.VirtualNetworkLink or IO
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a
|
||||
VirtualNetworkLink type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.VirtualNetworkLink or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -271,17 +249,6 @@ class VirtualNetworkLinksOperations:
|
|||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either VirtualNetworkLink or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.VirtualNetworkLink]
|
||||
|
@ -290,9 +257,7 @@ class VirtualNetworkLinksOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.VirtualNetworkLink] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
|
@ -313,12 +278,13 @@ class VirtualNetworkLinksOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("VirtualNetworkLink", pipeline_response)
|
||||
deserialized = self._deserialize("VirtualNetworkLink", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
|
@ -328,28 +294,26 @@ class VirtualNetworkLinksOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller.from_continuation_token(
|
||||
return AsyncLROPoller[_models.VirtualNetworkLink].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
begin_create_or_update.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"
|
||||
}
|
||||
return AsyncLROPoller[_models.VirtualNetworkLink](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
async def _update_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
virtual_network_link_name: str,
|
||||
parameters: Union[_models.VirtualNetworkLinkPatch, IO],
|
||||
parameters: Union[_models.VirtualNetworkLinkPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> Optional[_models.VirtualNetworkLink]:
|
||||
error_map = {
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -360,21 +324,19 @@ class VirtualNetworkLinksOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[Optional[_models.VirtualNetworkLink]] = kwargs.pop("cls", None)
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IO, bytes)):
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "VirtualNetworkLinkPatch")
|
||||
|
||||
request = build_update_request(
|
||||
_request = build_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
virtual_network_link_name=virtual_network_link_name,
|
||||
|
@ -384,35 +346,33 @@ class VirtualNetworkLinksOperations:
|
|||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
template_url=self._update_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 202]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = None
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize("VirtualNetworkLink", pipeline_response)
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
_update_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
async def begin_update(
|
||||
|
@ -444,14 +404,6 @@ class VirtualNetworkLinksOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either VirtualNetworkLink or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.VirtualNetworkLink]
|
||||
|
@ -464,7 +416,7 @@ class VirtualNetworkLinksOperations:
|
|||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
virtual_network_link_name: str,
|
||||
parameters: IO,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
|
@ -480,7 +432,7 @@ class VirtualNetworkLinksOperations:
|
|||
:param virtual_network_link_name: The name of the virtual network link. Required.
|
||||
:type virtual_network_link_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Required.
|
||||
:type parameters: IO
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -488,14 +440,6 @@ class VirtualNetworkLinksOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either VirtualNetworkLink or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.VirtualNetworkLink]
|
||||
|
@ -508,7 +452,7 @@ class VirtualNetworkLinksOperations:
|
|||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
virtual_network_link_name: str,
|
||||
parameters: Union[_models.VirtualNetworkLinkPatch, IO],
|
||||
parameters: Union[_models.VirtualNetworkLinkPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> AsyncLROPoller[_models.VirtualNetworkLink]:
|
||||
|
@ -521,24 +465,13 @@ class VirtualNetworkLinksOperations:
|
|||
:type dns_forwarding_ruleset_name: str
|
||||
:param virtual_network_link_name: The name of the virtual network link. Required.
|
||||
:type virtual_network_link_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a model type or a IO
|
||||
type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.VirtualNetworkLinkPatch or IO
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a
|
||||
VirtualNetworkLinkPatch type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.VirtualNetworkLinkPatch or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either VirtualNetworkLink or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.VirtualNetworkLink]
|
||||
|
@ -547,9 +480,7 @@ class VirtualNetworkLinksOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.VirtualNetworkLink] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
|
@ -569,12 +500,13 @@ class VirtualNetworkLinksOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("VirtualNetworkLink", pipeline_response)
|
||||
deserialized = self._deserialize("VirtualNetworkLink", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
|
@ -584,27 +516,25 @@ class VirtualNetworkLinksOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller.from_continuation_token(
|
||||
return AsyncLROPoller[_models.VirtualNetworkLink].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
return AsyncLROPoller[_models.VirtualNetworkLink](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
begin_update.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"
|
||||
}
|
||||
|
||||
async def _delete_initial( # pylint: disable=inconsistent-return-statements
|
||||
async def _delete_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
virtual_network_link_name: str,
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> None:
|
||||
error_map = {
|
||||
) -> AsyncIterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -615,41 +545,43 @@ class VirtualNetworkLinksOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
request = build_delete_request(
|
||||
_request = build_delete_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
virtual_network_link_name=virtual_network_link_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
template_url=self._delete_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 202, 204]:
|
||||
try:
|
||||
await response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
_delete_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"
|
||||
}
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace_async
|
||||
async def begin_delete(
|
||||
|
@ -674,14 +606,6 @@ class VirtualNetworkLinksOperations:
|
|||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
|
||||
this operation to not poll, or pass in your own initialized polling object for a personal
|
||||
polling strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
|
||||
:rtype: ~azure.core.polling.AsyncLROPoller[None]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -689,15 +613,13 @@ class VirtualNetworkLinksOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
|
||||
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
||||
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
||||
if cont_token is None:
|
||||
raw_result = await self._delete_initial( # type: ignore
|
||||
raw_result = await self._delete_initial(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
virtual_network_link_name=virtual_network_link_name,
|
||||
|
@ -708,11 +630,12 @@ class VirtualNetworkLinksOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
await raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
return cls(pipeline_response, None, {}) # type: ignore
|
||||
|
||||
if polling is True:
|
||||
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
|
||||
|
@ -721,17 +644,13 @@ class VirtualNetworkLinksOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return AsyncLROPoller.from_continuation_token(
|
||||
return AsyncLROPoller[None].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
begin_delete.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"
|
||||
}
|
||||
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
@distributed_trace_async
|
||||
async def get(
|
||||
|
@ -746,12 +665,11 @@ class VirtualNetworkLinksOperations:
|
|||
:type dns_forwarding_ruleset_name: str
|
||||
:param virtual_network_link_name: The name of the virtual network link. Required.
|
||||
:type virtual_network_link_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: VirtualNetworkLink or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.VirtualNetworkLink
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -762,26 +680,23 @@ class VirtualNetworkLinksOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.VirtualNetworkLink] = kwargs.pop("cls", None)
|
||||
|
||||
request = build_get_request(
|
||||
_request = build_get_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
virtual_network_link_name=virtual_network_link_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
api_version=api_version,
|
||||
template_url=self.get.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
@ -790,16 +705,12 @@ class VirtualNetworkLinksOperations:
|
|||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = self._deserialize("VirtualNetworkLink", pipeline_response)
|
||||
deserialized = self._deserialize("VirtualNetworkLink", pipeline_response.http_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
get.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def list(
|
||||
|
@ -815,7 +726,6 @@ class VirtualNetworkLinksOperations:
|
|||
:param top: The maximum number of results to return. If not specified, returns up to 100
|
||||
results. Default value is None.
|
||||
:type top: int
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: An iterator like instance of either VirtualNetworkLink or the result of cls(response)
|
||||
:rtype:
|
||||
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.VirtualNetworkLink]
|
||||
|
@ -824,12 +734,10 @@ class VirtualNetworkLinksOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.VirtualNetworkLinkListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -840,18 +748,16 @@ class VirtualNetworkLinksOperations:
|
|||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
request = build_list_request(
|
||||
_request = build_list_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
top=top,
|
||||
api_version=api_version,
|
||||
template_url=self.list.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
|
@ -863,13 +769,12 @@ class VirtualNetworkLinksOperations:
|
|||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
request = HttpRequest(
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
request.method = "GET"
|
||||
return request
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
async def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("VirtualNetworkLinkListResult", pipeline_response)
|
||||
|
@ -879,10 +784,11 @@ class VirtualNetworkLinksOperations:
|
|||
return deserialized.next_link or None, AsyncList(list_of_elem)
|
||||
|
||||
async def get_next(next_link=None):
|
||||
request = prepare_request(next_link)
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
|
@ -893,7 +799,3 @@ class VirtualNetworkLinksOperations:
|
|||
return pipeline_response
|
||||
|
||||
return AsyncItemPaged(get_next, extract_data)
|
||||
|
||||
list.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks"
|
||||
}
|
||||
|
|
|
@ -11,8 +11,24 @@ from ._models_py3 import DnsForwardingRuleset
|
|||
from ._models_py3 import DnsForwardingRulesetListResult
|
||||
from ._models_py3 import DnsForwardingRulesetPatch
|
||||
from ._models_py3 import DnsResolver
|
||||
from ._models_py3 import DnsResolverDomainList
|
||||
from ._models_py3 import DnsResolverDomainListPatch
|
||||
from ._models_py3 import DnsResolverDomainListResult
|
||||
from ._models_py3 import DnsResolverListResult
|
||||
from ._models_py3 import DnsResolverPatch
|
||||
from ._models_py3 import DnsResolverPolicy
|
||||
from ._models_py3 import DnsResolverPolicyListResult
|
||||
from ._models_py3 import DnsResolverPolicyPatch
|
||||
from ._models_py3 import DnsResolverPolicyVirtualNetworkLink
|
||||
from ._models_py3 import DnsResolverPolicyVirtualNetworkLinkListResult
|
||||
from ._models_py3 import DnsResolverPolicyVirtualNetworkLinkPatch
|
||||
from ._models_py3 import DnsSecurityRule
|
||||
from ._models_py3 import DnsSecurityRuleAction
|
||||
from ._models_py3 import DnsSecurityRuleListResult
|
||||
from ._models_py3 import DnsSecurityRulePatch
|
||||
from ._models_py3 import ErrorAdditionalInfo
|
||||
from ._models_py3 import ErrorDetail
|
||||
from ._models_py3 import ErrorResponse
|
||||
from ._models_py3 import ForwardingRule
|
||||
from ._models_py3 import ForwardingRuleListResult
|
||||
from ._models_py3 import ForwardingRulePatch
|
||||
|
@ -36,8 +52,11 @@ from ._models_py3 import VirtualNetworkLink
|
|||
from ._models_py3 import VirtualNetworkLinkListResult
|
||||
from ._models_py3 import VirtualNetworkLinkPatch
|
||||
|
||||
from ._dns_resolver_management_client_enums import ActionType
|
||||
from ._dns_resolver_management_client_enums import BlockResponseCode
|
||||
from ._dns_resolver_management_client_enums import CreatedByType
|
||||
from ._dns_resolver_management_client_enums import DnsResolverState
|
||||
from ._dns_resolver_management_client_enums import DnsSecurityRuleState
|
||||
from ._dns_resolver_management_client_enums import ForwardingRuleState
|
||||
from ._dns_resolver_management_client_enums import IpAllocationMethod
|
||||
from ._dns_resolver_management_client_enums import ProvisioningState
|
||||
|
@ -51,8 +70,24 @@ __all__ = [
|
|||
"DnsForwardingRulesetListResult",
|
||||
"DnsForwardingRulesetPatch",
|
||||
"DnsResolver",
|
||||
"DnsResolverDomainList",
|
||||
"DnsResolverDomainListPatch",
|
||||
"DnsResolverDomainListResult",
|
||||
"DnsResolverListResult",
|
||||
"DnsResolverPatch",
|
||||
"DnsResolverPolicy",
|
||||
"DnsResolverPolicyListResult",
|
||||
"DnsResolverPolicyPatch",
|
||||
"DnsResolverPolicyVirtualNetworkLink",
|
||||
"DnsResolverPolicyVirtualNetworkLinkListResult",
|
||||
"DnsResolverPolicyVirtualNetworkLinkPatch",
|
||||
"DnsSecurityRule",
|
||||
"DnsSecurityRuleAction",
|
||||
"DnsSecurityRuleListResult",
|
||||
"DnsSecurityRulePatch",
|
||||
"ErrorAdditionalInfo",
|
||||
"ErrorDetail",
|
||||
"ErrorResponse",
|
||||
"ForwardingRule",
|
||||
"ForwardingRuleListResult",
|
||||
"ForwardingRulePatch",
|
||||
|
@ -75,8 +110,11 @@ __all__ = [
|
|||
"VirtualNetworkLink",
|
||||
"VirtualNetworkLinkListResult",
|
||||
"VirtualNetworkLinkPatch",
|
||||
"ActionType",
|
||||
"BlockResponseCode",
|
||||
"CreatedByType",
|
||||
"DnsResolverState",
|
||||
"DnsSecurityRuleState",
|
||||
"ForwardingRuleState",
|
||||
"IpAllocationMethod",
|
||||
"ProvisioningState",
|
||||
|
|
|
@ -10,6 +10,20 @@ from enum import Enum
|
|||
from azure.core import CaseInsensitiveEnumMeta
|
||||
|
||||
|
||||
class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
|
||||
"""The type of action to take."""
|
||||
|
||||
ALLOW = "Allow"
|
||||
ALERT = "Alert"
|
||||
BLOCK = "Block"
|
||||
|
||||
|
||||
class BlockResponseCode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
|
||||
"""The response code for block actions."""
|
||||
|
||||
SERVFAIL = "SERVFAIL"
|
||||
|
||||
|
||||
class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
|
||||
"""The type of identity that created the resource."""
|
||||
|
||||
|
@ -28,6 +42,13 @@ class DnsResolverState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
|
|||
DISCONNECTED = "Disconnected"
|
||||
|
||||
|
||||
class DnsSecurityRuleState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
|
||||
"""The state of DNS security rule."""
|
||||
|
||||
ENABLED = "Enabled"
|
||||
DISABLED = "Disabled"
|
||||
|
||||
|
||||
class ForwardingRuleState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
|
||||
"""The state of forwarding rule."""
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -12,6 +12,10 @@ from ._outbound_endpoints_operations import OutboundEndpointsOperations
|
|||
from ._dns_forwarding_rulesets_operations import DnsForwardingRulesetsOperations
|
||||
from ._forwarding_rules_operations import ForwardingRulesOperations
|
||||
from ._virtual_network_links_operations import VirtualNetworkLinksOperations
|
||||
from ._dns_resolver_policies_operations import DnsResolverPoliciesOperations
|
||||
from ._dns_security_rules_operations import DnsSecurityRulesOperations
|
||||
from ._dns_resolver_policy_virtual_network_links_operations import DnsResolverPolicyVirtualNetworkLinksOperations
|
||||
from ._dns_resolver_domain_lists_operations import DnsResolverDomainListsOperations
|
||||
|
||||
from ._patch import __all__ as _patch_all
|
||||
from ._patch import * # pylint: disable=unused-wildcard-import
|
||||
|
@ -24,6 +28,10 @@ __all__ = [
|
|||
"DnsForwardingRulesetsOperations",
|
||||
"ForwardingRulesOperations",
|
||||
"VirtualNetworkLinksOperations",
|
||||
"DnsResolverPoliciesOperations",
|
||||
"DnsSecurityRulesOperations",
|
||||
"DnsResolverPolicyVirtualNetworkLinksOperations",
|
||||
"DnsResolverDomainListsOperations",
|
||||
]
|
||||
__all__.extend([p for p in _patch_all if p not in __all__])
|
||||
_patch_sdk()
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,4 +1,4 @@
|
|||
# pylint: disable=too-many-lines
|
||||
# pylint: disable=too-many-lines,too-many-statements
|
||||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
@ -6,8 +6,9 @@
|
|||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
from io import IOBase
|
||||
import sys
|
||||
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
|
||||
from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
|
||||
import urllib.parse
|
||||
|
||||
from azure.core.exceptions import (
|
||||
|
@ -20,20 +21,18 @@ from azure.core.exceptions import (
|
|||
)
|
||||
from azure.core.paging import ItemPaged
|
||||
from azure.core.pipeline import PipelineResponse
|
||||
from azure.core.pipeline.transport import HttpResponse
|
||||
from azure.core.rest import HttpRequest
|
||||
from azure.core.rest import HttpRequest, HttpResponse
|
||||
from azure.core.tracing.decorator import distributed_trace
|
||||
from azure.core.utils import case_insensitive_dict
|
||||
from azure.mgmt.core.exceptions import ARMErrorFormat
|
||||
|
||||
from .. import models as _models
|
||||
from .._serialization import Serializer
|
||||
from .._vendor import _convert_request, _format_url_section
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
|
||||
if sys.version_info >= (3, 9):
|
||||
from collections.abc import MutableMapping
|
||||
else:
|
||||
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
|
||||
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
|
||||
T = TypeVar("T")
|
||||
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
|
||||
|
||||
|
@ -54,7 +53,7 @@ def build_create_or_update_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview"))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
|
@ -64,7 +63,7 @@ def build_create_or_update_request(
|
|||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}",
|
||||
) # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
||||
"resourceGroupName": _SERIALIZER.url(
|
||||
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
|
||||
),
|
||||
|
@ -72,7 +71,7 @@ def build_create_or_update_request(
|
|||
"forwardingRuleName": _SERIALIZER.url("forwarding_rule_name", forwarding_rule_name, "str"),
|
||||
}
|
||||
|
||||
_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
|
||||
_url: str = _url.format(**path_format_arguments) # type: ignore
|
||||
|
||||
# Construct parameters
|
||||
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
||||
|
@ -101,7 +100,7 @@ def build_update_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview"))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
|
@ -111,7 +110,7 @@ def build_update_request(
|
|||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}",
|
||||
) # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
||||
"resourceGroupName": _SERIALIZER.url(
|
||||
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
|
||||
),
|
||||
|
@ -119,7 +118,7 @@ def build_update_request(
|
|||
"forwardingRuleName": _SERIALIZER.url("forwarding_rule_name", forwarding_rule_name, "str"),
|
||||
}
|
||||
|
||||
_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
|
||||
_url: str = _url.format(**path_format_arguments) # type: ignore
|
||||
|
||||
# Construct parameters
|
||||
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
||||
|
@ -146,7 +145,7 @@ def build_delete_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview"))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
# Construct URL
|
||||
|
@ -155,7 +154,7 @@ def build_delete_request(
|
|||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}",
|
||||
) # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
||||
"resourceGroupName": _SERIALIZER.url(
|
||||
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
|
||||
),
|
||||
|
@ -163,7 +162,7 @@ def build_delete_request(
|
|||
"forwardingRuleName": _SERIALIZER.url("forwarding_rule_name", forwarding_rule_name, "str"),
|
||||
}
|
||||
|
||||
_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
|
||||
_url: str = _url.format(**path_format_arguments) # type: ignore
|
||||
|
||||
# Construct parameters
|
||||
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
||||
|
@ -186,7 +185,7 @@ def build_get_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview"))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
# Construct URL
|
||||
|
@ -195,7 +194,7 @@ def build_get_request(
|
|||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}",
|
||||
) # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
||||
"resourceGroupName": _SERIALIZER.url(
|
||||
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
|
||||
),
|
||||
|
@ -203,7 +202,7 @@ def build_get_request(
|
|||
"forwardingRuleName": _SERIALIZER.url("forwarding_rule_name", forwarding_rule_name, "str"),
|
||||
}
|
||||
|
||||
_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
|
||||
_url: str = _url.format(**path_format_arguments) # type: ignore
|
||||
|
||||
# Construct parameters
|
||||
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
||||
|
@ -225,7 +224,7 @@ def build_list_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview"))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
# Construct URL
|
||||
|
@ -234,14 +233,14 @@ def build_list_request(
|
|||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules",
|
||||
) # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
||||
"resourceGroupName": _SERIALIZER.url(
|
||||
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
|
||||
),
|
||||
"dnsForwardingRulesetName": _SERIALIZER.url("dns_forwarding_ruleset_name", dns_forwarding_ruleset_name, "str"),
|
||||
}
|
||||
|
||||
_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
|
||||
_url: str = _url.format(**path_format_arguments) # type: ignore
|
||||
|
||||
# Construct parameters
|
||||
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
||||
|
@ -307,7 +306,6 @@ class ForwardingRulesOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: ForwardingRule or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.ForwardingRule
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -319,7 +317,7 @@ class ForwardingRulesOperations:
|
|||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
forwarding_rule_name: str,
|
||||
parameters: IO,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
*,
|
||||
|
@ -336,7 +334,7 @@ class ForwardingRulesOperations:
|
|||
:param forwarding_rule_name: The name of the forwarding rule. Required.
|
||||
:type forwarding_rule_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Required.
|
||||
:type parameters: IO
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -347,7 +345,6 @@ class ForwardingRulesOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: ForwardingRule or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.ForwardingRule
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -359,7 +356,7 @@ class ForwardingRulesOperations:
|
|||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
forwarding_rule_name: str,
|
||||
parameters: Union[_models.ForwardingRule, IO],
|
||||
parameters: Union[_models.ForwardingRule, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
|
@ -373,9 +370,9 @@ class ForwardingRulesOperations:
|
|||
:type dns_forwarding_ruleset_name: str
|
||||
:param forwarding_rule_name: The name of the forwarding rule. Required.
|
||||
:type forwarding_rule_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a model type
|
||||
or a IO type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.ForwardingRule or IO
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a
|
||||
ForwardingRule type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.ForwardingRule or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -383,15 +380,11 @@ class ForwardingRulesOperations:
|
|||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: ForwardingRule or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.ForwardingRule
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -402,21 +395,19 @@ class ForwardingRulesOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.ForwardingRule] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IO, bytes)):
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "ForwardingRule")
|
||||
|
||||
request = build_create_or_update_request(
|
||||
_request = build_create_or_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
forwarding_rule_name=forwarding_rule_name,
|
||||
|
@ -427,15 +418,14 @@ class ForwardingRulesOperations:
|
|||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
template_url=self.create_or_update.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
@ -444,21 +434,13 @@ class ForwardingRulesOperations:
|
|||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize("ForwardingRule", pipeline_response)
|
||||
|
||||
if response.status_code == 201:
|
||||
deserialized = self._deserialize("ForwardingRule", pipeline_response)
|
||||
deserialized = self._deserialize("ForwardingRule", pipeline_response.http_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
create_or_update.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}"
|
||||
}
|
||||
|
||||
@overload
|
||||
def update(
|
||||
self,
|
||||
|
@ -489,7 +471,6 @@ class ForwardingRulesOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: ForwardingRule or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.ForwardingRule
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -501,7 +482,7 @@ class ForwardingRulesOperations:
|
|||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
forwarding_rule_name: str,
|
||||
parameters: IO,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
|
@ -517,7 +498,7 @@ class ForwardingRulesOperations:
|
|||
:param forwarding_rule_name: The name of the forwarding rule. Required.
|
||||
:type forwarding_rule_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Required.
|
||||
:type parameters: IO
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -525,7 +506,6 @@ class ForwardingRulesOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: ForwardingRule or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.ForwardingRule
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -537,7 +517,7 @@ class ForwardingRulesOperations:
|
|||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
forwarding_rule_name: str,
|
||||
parameters: Union[_models.ForwardingRulePatch, IO],
|
||||
parameters: Union[_models.ForwardingRulePatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> _models.ForwardingRule:
|
||||
|
@ -550,22 +530,18 @@ class ForwardingRulesOperations:
|
|||
:type dns_forwarding_ruleset_name: str
|
||||
:param forwarding_rule_name: The name of the forwarding rule. Required.
|
||||
:type forwarding_rule_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a model type or a IO
|
||||
type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.ForwardingRulePatch or IO
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a ForwardingRulePatch
|
||||
type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.ForwardingRulePatch or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: ForwardingRule or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.ForwardingRule
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -576,21 +552,19 @@ class ForwardingRulesOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.ForwardingRule] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IO, bytes)):
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "ForwardingRulePatch")
|
||||
|
||||
request = build_update_request(
|
||||
_request = build_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
forwarding_rule_name=forwarding_rule_name,
|
||||
|
@ -600,15 +574,14 @@ class ForwardingRulesOperations:
|
|||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
template_url=self.update.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
@ -617,16 +590,12 @@ class ForwardingRulesOperations:
|
|||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = self._deserialize("ForwardingRule", pipeline_response)
|
||||
deserialized = self._deserialize("ForwardingRule", pipeline_response.http_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
update.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def delete( # pylint: disable=inconsistent-return-statements
|
||||
|
@ -651,12 +620,11 @@ class ForwardingRulesOperations:
|
|||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: None or the result of cls(response)
|
||||
:rtype: None
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -667,27 +635,24 @@ class ForwardingRulesOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
|
||||
request = build_delete_request(
|
||||
_request = build_delete_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
forwarding_rule_name=forwarding_rule_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
template_url=self.delete.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
@ -697,11 +662,7 @@ class ForwardingRulesOperations:
|
|||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
|
||||
delete.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}"
|
||||
}
|
||||
return cls(pipeline_response, None, {}) # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def get(
|
||||
|
@ -716,12 +677,11 @@ class ForwardingRulesOperations:
|
|||
:type dns_forwarding_ruleset_name: str
|
||||
:param forwarding_rule_name: The name of the forwarding rule. Required.
|
||||
:type forwarding_rule_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: ForwardingRule or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.ForwardingRule
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -732,26 +692,23 @@ class ForwardingRulesOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.ForwardingRule] = kwargs.pop("cls", None)
|
||||
|
||||
request = build_get_request(
|
||||
_request = build_get_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
forwarding_rule_name=forwarding_rule_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
api_version=api_version,
|
||||
template_url=self.get.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
@ -760,16 +717,12 @@ class ForwardingRulesOperations:
|
|||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = self._deserialize("ForwardingRule", pipeline_response)
|
||||
deserialized = self._deserialize("ForwardingRule", pipeline_response.http_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
get.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def list(
|
||||
|
@ -785,7 +738,6 @@ class ForwardingRulesOperations:
|
|||
:param top: The maximum number of results to return. If not specified, returns up to 100
|
||||
results. Default value is None.
|
||||
:type top: int
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: An iterator like instance of either ForwardingRule or the result of cls(response)
|
||||
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dnsresolver.models.ForwardingRule]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -793,12 +745,10 @@ class ForwardingRulesOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.ForwardingRuleListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -809,18 +759,16 @@ class ForwardingRulesOperations:
|
|||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
request = build_list_request(
|
||||
_request = build_list_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
top=top,
|
||||
api_version=api_version,
|
||||
template_url=self.list.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
|
@ -832,13 +780,12 @@ class ForwardingRulesOperations:
|
|||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
request = HttpRequest(
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
request.method = "GET"
|
||||
return request
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("ForwardingRuleListResult", pipeline_response)
|
||||
|
@ -848,10 +795,11 @@ class ForwardingRulesOperations:
|
|||
return deserialized.next_link or None, iter(list_of_elem)
|
||||
|
||||
def get_next(next_link=None):
|
||||
request = prepare_request(next_link)
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
|
@ -862,7 +810,3 @@ class ForwardingRulesOperations:
|
|||
return pipeline_response
|
||||
|
||||
return ItemPaged(get_next, extract_data)
|
||||
|
||||
list.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules"
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# pylint: disable=too-many-lines
|
||||
# pylint: disable=too-many-lines,too-many-statements
|
||||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
@ -6,8 +6,9 @@
|
|||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
from io import IOBase
|
||||
import sys
|
||||
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
|
||||
from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
|
||||
import urllib.parse
|
||||
|
||||
from azure.core.exceptions import (
|
||||
|
@ -16,13 +17,14 @@ from azure.core.exceptions import (
|
|||
ResourceExistsError,
|
||||
ResourceNotFoundError,
|
||||
ResourceNotModifiedError,
|
||||
StreamClosedError,
|
||||
StreamConsumedError,
|
||||
map_error,
|
||||
)
|
||||
from azure.core.paging import ItemPaged
|
||||
from azure.core.pipeline import PipelineResponse
|
||||
from azure.core.pipeline.transport import HttpResponse
|
||||
from azure.core.polling import LROPoller, NoPolling, PollingMethod
|
||||
from azure.core.rest import HttpRequest
|
||||
from azure.core.rest import HttpRequest, HttpResponse
|
||||
from azure.core.tracing.decorator import distributed_trace
|
||||
from azure.core.utils import case_insensitive_dict
|
||||
from azure.mgmt.core.exceptions import ARMErrorFormat
|
||||
|
@ -30,12 +32,11 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling
|
|||
|
||||
from .. import models as _models
|
||||
from .._serialization import Serializer
|
||||
from .._vendor import _convert_request, _format_url_section
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
|
||||
if sys.version_info >= (3, 9):
|
||||
from collections.abc import MutableMapping
|
||||
else:
|
||||
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
|
||||
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
|
||||
T = TypeVar("T")
|
||||
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
|
||||
|
||||
|
@ -56,7 +57,7 @@ def build_create_or_update_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview"))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
|
@ -66,7 +67,7 @@ def build_create_or_update_request(
|
|||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}",
|
||||
) # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
||||
"resourceGroupName": _SERIALIZER.url(
|
||||
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
|
||||
),
|
||||
|
@ -74,7 +75,7 @@ def build_create_or_update_request(
|
|||
"inboundEndpointName": _SERIALIZER.url("inbound_endpoint_name", inbound_endpoint_name, "str"),
|
||||
}
|
||||
|
||||
_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
|
||||
_url: str = _url.format(**path_format_arguments) # type: ignore
|
||||
|
||||
# Construct parameters
|
||||
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
||||
|
@ -103,7 +104,7 @@ def build_update_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview"))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
|
@ -113,7 +114,7 @@ def build_update_request(
|
|||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}",
|
||||
) # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
||||
"resourceGroupName": _SERIALIZER.url(
|
||||
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
|
||||
),
|
||||
|
@ -121,7 +122,7 @@ def build_update_request(
|
|||
"inboundEndpointName": _SERIALIZER.url("inbound_endpoint_name", inbound_endpoint_name, "str"),
|
||||
}
|
||||
|
||||
_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
|
||||
_url: str = _url.format(**path_format_arguments) # type: ignore
|
||||
|
||||
# Construct parameters
|
||||
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
||||
|
@ -148,7 +149,7 @@ def build_delete_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview"))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
# Construct URL
|
||||
|
@ -157,7 +158,7 @@ def build_delete_request(
|
|||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}",
|
||||
) # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
||||
"resourceGroupName": _SERIALIZER.url(
|
||||
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
|
||||
),
|
||||
|
@ -165,7 +166,7 @@ def build_delete_request(
|
|||
"inboundEndpointName": _SERIALIZER.url("inbound_endpoint_name", inbound_endpoint_name, "str"),
|
||||
}
|
||||
|
||||
_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
|
||||
_url: str = _url.format(**path_format_arguments) # type: ignore
|
||||
|
||||
# Construct parameters
|
||||
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
||||
|
@ -184,7 +185,7 @@ def build_get_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview"))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
# Construct URL
|
||||
|
@ -193,7 +194,7 @@ def build_get_request(
|
|||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}",
|
||||
) # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
||||
"resourceGroupName": _SERIALIZER.url(
|
||||
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
|
||||
),
|
||||
|
@ -201,7 +202,7 @@ def build_get_request(
|
|||
"inboundEndpointName": _SERIALIZER.url("inbound_endpoint_name", inbound_endpoint_name, "str"),
|
||||
}
|
||||
|
||||
_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
|
||||
_url: str = _url.format(**path_format_arguments) # type: ignore
|
||||
|
||||
# Construct parameters
|
||||
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
||||
|
@ -218,7 +219,7 @@ def build_list_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview"))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
# Construct URL
|
||||
|
@ -227,14 +228,14 @@ def build_list_request(
|
|||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints",
|
||||
) # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
||||
"resourceGroupName": _SERIALIZER.url(
|
||||
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
|
||||
),
|
||||
"dnsResolverName": _SERIALIZER.url("dns_resolver_name", dns_resolver_name, "str"),
|
||||
}
|
||||
|
||||
_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
|
||||
_url: str = _url.format(**path_format_arguments) # type: ignore
|
||||
|
||||
# Construct parameters
|
||||
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
||||
|
@ -271,12 +272,12 @@ class InboundEndpointsOperations:
|
|||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
inbound_endpoint_name: str,
|
||||
parameters: Union[_models.InboundEndpoint, IO],
|
||||
parameters: Union[_models.InboundEndpoint, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> Optional[_models.InboundEndpoint]:
|
||||
error_map = {
|
||||
) -> Iterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -287,21 +288,19 @@ class InboundEndpointsOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[Optional[_models.InboundEndpoint]] = kwargs.pop("cls", None)
|
||||
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IO, bytes)):
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "InboundEndpoint")
|
||||
|
||||
request = build_create_or_update_request(
|
||||
_request = build_create_or_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
inbound_endpoint_name=inbound_endpoint_name,
|
||||
|
@ -312,38 +311,33 @@ class InboundEndpointsOperations:
|
|||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
template_url=self._create_or_update_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 201, 202]:
|
||||
try:
|
||||
response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = None
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize("InboundEndpoint", pipeline_response)
|
||||
|
||||
if response.status_code == 201:
|
||||
deserialized = self._deserialize("InboundEndpoint", pipeline_response)
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
_create_or_update_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
def begin_create_or_update(
|
||||
|
@ -379,14 +373,6 @@ class InboundEndpointsOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either InboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.InboundEndpoint]
|
||||
|
@ -399,7 +385,7 @@ class InboundEndpointsOperations:
|
|||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
inbound_endpoint_name: str,
|
||||
parameters: IO,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
*,
|
||||
|
@ -416,7 +402,7 @@ class InboundEndpointsOperations:
|
|||
:param inbound_endpoint_name: The name of the inbound endpoint for the DNS resolver. Required.
|
||||
:type inbound_endpoint_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Required.
|
||||
:type parameters: IO
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -427,14 +413,6 @@ class InboundEndpointsOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either InboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.InboundEndpoint]
|
||||
|
@ -447,7 +425,7 @@ class InboundEndpointsOperations:
|
|||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
inbound_endpoint_name: str,
|
||||
parameters: Union[_models.InboundEndpoint, IO],
|
||||
parameters: Union[_models.InboundEndpoint, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
|
@ -461,9 +439,9 @@ class InboundEndpointsOperations:
|
|||
:type dns_resolver_name: str
|
||||
:param inbound_endpoint_name: The name of the inbound endpoint for the DNS resolver. Required.
|
||||
:type inbound_endpoint_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a model type
|
||||
or a IO type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.InboundEndpoint or IO
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a
|
||||
InboundEndpoint type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.InboundEndpoint or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -471,17 +449,6 @@ class InboundEndpointsOperations:
|
|||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either InboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.InboundEndpoint]
|
||||
|
@ -490,9 +457,7 @@ class InboundEndpointsOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.InboundEndpoint] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
|
||||
|
@ -513,12 +478,13 @@ class InboundEndpointsOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("InboundEndpoint", pipeline_response)
|
||||
deserialized = self._deserialize("InboundEndpoint", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
|
@ -528,28 +494,26 @@ class InboundEndpointsOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return LROPoller.from_continuation_token(
|
||||
return LROPoller[_models.InboundEndpoint].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
begin_create_or_update.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"
|
||||
}
|
||||
return LROPoller[_models.InboundEndpoint](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
def _update_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
inbound_endpoint_name: str,
|
||||
parameters: Union[_models.InboundEndpointPatch, IO],
|
||||
parameters: Union[_models.InboundEndpointPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> Optional[_models.InboundEndpoint]:
|
||||
error_map = {
|
||||
) -> Iterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -560,21 +524,19 @@ class InboundEndpointsOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[Optional[_models.InboundEndpoint]] = kwargs.pop("cls", None)
|
||||
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IO, bytes)):
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "InboundEndpointPatch")
|
||||
|
||||
request = build_update_request(
|
||||
_request = build_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
inbound_endpoint_name=inbound_endpoint_name,
|
||||
|
@ -584,35 +546,33 @@ class InboundEndpointsOperations:
|
|||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
template_url=self._update_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 202]:
|
||||
try:
|
||||
response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = None
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize("InboundEndpoint", pipeline_response)
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
_update_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
def begin_update(
|
||||
|
@ -644,14 +604,6 @@ class InboundEndpointsOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either InboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.InboundEndpoint]
|
||||
|
@ -664,7 +616,7 @@ class InboundEndpointsOperations:
|
|||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
inbound_endpoint_name: str,
|
||||
parameters: IO,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
|
@ -680,7 +632,7 @@ class InboundEndpointsOperations:
|
|||
:param inbound_endpoint_name: The name of the inbound endpoint for the DNS resolver. Required.
|
||||
:type inbound_endpoint_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Required.
|
||||
:type parameters: IO
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -688,14 +640,6 @@ class InboundEndpointsOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either InboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.InboundEndpoint]
|
||||
|
@ -708,7 +652,7 @@ class InboundEndpointsOperations:
|
|||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
inbound_endpoint_name: str,
|
||||
parameters: Union[_models.InboundEndpointPatch, IO],
|
||||
parameters: Union[_models.InboundEndpointPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> LROPoller[_models.InboundEndpoint]:
|
||||
|
@ -721,24 +665,13 @@ class InboundEndpointsOperations:
|
|||
:type dns_resolver_name: str
|
||||
:param inbound_endpoint_name: The name of the inbound endpoint for the DNS resolver. Required.
|
||||
:type inbound_endpoint_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a model type or a IO
|
||||
type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.InboundEndpointPatch or IO
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a
|
||||
InboundEndpointPatch type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.InboundEndpointPatch or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either InboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.InboundEndpoint]
|
||||
|
@ -747,9 +680,7 @@ class InboundEndpointsOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.InboundEndpoint] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
|
||||
|
@ -769,12 +700,13 @@ class InboundEndpointsOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("InboundEndpoint", pipeline_response)
|
||||
deserialized = self._deserialize("InboundEndpoint", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
|
@ -784,27 +716,25 @@ class InboundEndpointsOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return LROPoller.from_continuation_token(
|
||||
return LROPoller[_models.InboundEndpoint].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
return LROPoller[_models.InboundEndpoint](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
begin_update.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"
|
||||
}
|
||||
|
||||
def _delete_initial( # pylint: disable=inconsistent-return-statements
|
||||
def _delete_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
inbound_endpoint_name: str,
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> None:
|
||||
error_map = {
|
||||
) -> Iterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -815,41 +745,43 @@ class InboundEndpointsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
request = build_delete_request(
|
||||
_request = build_delete_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
inbound_endpoint_name=inbound_endpoint_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
template_url=self._delete_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 202, 204]:
|
||||
try:
|
||||
response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
_delete_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"
|
||||
}
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def begin_delete(
|
||||
|
@ -873,14 +805,6 @@ class InboundEndpointsOperations:
|
|||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either None or the result of cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[None]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -888,15 +812,13 @@ class InboundEndpointsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
|
||||
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
||||
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
||||
if cont_token is None:
|
||||
raw_result = self._delete_initial( # type: ignore
|
||||
raw_result = self._delete_initial(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
inbound_endpoint_name=inbound_endpoint_name,
|
||||
|
@ -907,11 +829,12 @@ class InboundEndpointsOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
return cls(pipeline_response, None, {}) # type: ignore
|
||||
|
||||
if polling is True:
|
||||
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
|
||||
|
@ -920,17 +843,13 @@ class InboundEndpointsOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return LROPoller.from_continuation_token(
|
||||
return LROPoller[None].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
begin_delete.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"
|
||||
}
|
||||
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def get(
|
||||
|
@ -945,12 +864,11 @@ class InboundEndpointsOperations:
|
|||
:type dns_resolver_name: str
|
||||
:param inbound_endpoint_name: The name of the inbound endpoint for the DNS resolver. Required.
|
||||
:type inbound_endpoint_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: InboundEndpoint or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.InboundEndpoint
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -961,26 +879,23 @@ class InboundEndpointsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.InboundEndpoint] = kwargs.pop("cls", None)
|
||||
|
||||
request = build_get_request(
|
||||
_request = build_get_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
inbound_endpoint_name=inbound_endpoint_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
api_version=api_version,
|
||||
template_url=self.get.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
@ -989,16 +904,12 @@ class InboundEndpointsOperations:
|
|||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = self._deserialize("InboundEndpoint", pipeline_response)
|
||||
deserialized = self._deserialize("InboundEndpoint", pipeline_response.http_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
get.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def list(
|
||||
|
@ -1014,7 +925,6 @@ class InboundEndpointsOperations:
|
|||
:param top: The maximum number of results to return. If not specified, returns up to 100
|
||||
results. Default value is None.
|
||||
:type top: int
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: An iterator like instance of either InboundEndpoint or the result of cls(response)
|
||||
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dnsresolver.models.InboundEndpoint]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -1022,12 +932,10 @@ class InboundEndpointsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.InboundEndpointListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -1038,18 +946,16 @@ class InboundEndpointsOperations:
|
|||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
request = build_list_request(
|
||||
_request = build_list_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
top=top,
|
||||
api_version=api_version,
|
||||
template_url=self.list.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
|
@ -1061,13 +967,12 @@ class InboundEndpointsOperations:
|
|||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
request = HttpRequest(
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
request.method = "GET"
|
||||
return request
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("InboundEndpointListResult", pipeline_response)
|
||||
|
@ -1077,10 +982,11 @@ class InboundEndpointsOperations:
|
|||
return deserialized.next_link or None, iter(list_of_elem)
|
||||
|
||||
def get_next(next_link=None):
|
||||
request = prepare_request(next_link)
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
|
@ -1091,7 +997,3 @@ class InboundEndpointsOperations:
|
|||
return pipeline_response
|
||||
|
||||
return ItemPaged(get_next, extract_data)
|
||||
|
||||
list.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints"
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# pylint: disable=too-many-lines
|
||||
# pylint: disable=too-many-lines,too-many-statements
|
||||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
@ -6,8 +6,9 @@
|
|||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
from io import IOBase
|
||||
import sys
|
||||
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
|
||||
from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
|
||||
import urllib.parse
|
||||
|
||||
from azure.core.exceptions import (
|
||||
|
@ -16,13 +17,14 @@ from azure.core.exceptions import (
|
|||
ResourceExistsError,
|
||||
ResourceNotFoundError,
|
||||
ResourceNotModifiedError,
|
||||
StreamClosedError,
|
||||
StreamConsumedError,
|
||||
map_error,
|
||||
)
|
||||
from azure.core.paging import ItemPaged
|
||||
from azure.core.pipeline import PipelineResponse
|
||||
from azure.core.pipeline.transport import HttpResponse
|
||||
from azure.core.polling import LROPoller, NoPolling, PollingMethod
|
||||
from azure.core.rest import HttpRequest
|
||||
from azure.core.rest import HttpRequest, HttpResponse
|
||||
from azure.core.tracing.decorator import distributed_trace
|
||||
from azure.core.utils import case_insensitive_dict
|
||||
from azure.mgmt.core.exceptions import ARMErrorFormat
|
||||
|
@ -30,12 +32,11 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling
|
|||
|
||||
from .. import models as _models
|
||||
from .._serialization import Serializer
|
||||
from .._vendor import _convert_request, _format_url_section
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
|
||||
if sys.version_info >= (3, 9):
|
||||
from collections.abc import MutableMapping
|
||||
else:
|
||||
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
|
||||
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
|
||||
T = TypeVar("T")
|
||||
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
|
||||
|
||||
|
@ -56,7 +57,7 @@ def build_create_or_update_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview"))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
|
@ -66,7 +67,7 @@ def build_create_or_update_request(
|
|||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}",
|
||||
) # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
||||
"resourceGroupName": _SERIALIZER.url(
|
||||
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
|
||||
),
|
||||
|
@ -74,7 +75,7 @@ def build_create_or_update_request(
|
|||
"outboundEndpointName": _SERIALIZER.url("outbound_endpoint_name", outbound_endpoint_name, "str"),
|
||||
}
|
||||
|
||||
_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
|
||||
_url: str = _url.format(**path_format_arguments) # type: ignore
|
||||
|
||||
# Construct parameters
|
||||
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
||||
|
@ -103,7 +104,7 @@ def build_update_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview"))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
|
@ -113,7 +114,7 @@ def build_update_request(
|
|||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}",
|
||||
) # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
||||
"resourceGroupName": _SERIALIZER.url(
|
||||
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
|
||||
),
|
||||
|
@ -121,7 +122,7 @@ def build_update_request(
|
|||
"outboundEndpointName": _SERIALIZER.url("outbound_endpoint_name", outbound_endpoint_name, "str"),
|
||||
}
|
||||
|
||||
_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
|
||||
_url: str = _url.format(**path_format_arguments) # type: ignore
|
||||
|
||||
# Construct parameters
|
||||
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
||||
|
@ -148,7 +149,7 @@ def build_delete_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview"))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
# Construct URL
|
||||
|
@ -157,7 +158,7 @@ def build_delete_request(
|
|||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}",
|
||||
) # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
||||
"resourceGroupName": _SERIALIZER.url(
|
||||
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
|
||||
),
|
||||
|
@ -165,7 +166,7 @@ def build_delete_request(
|
|||
"outboundEndpointName": _SERIALIZER.url("outbound_endpoint_name", outbound_endpoint_name, "str"),
|
||||
}
|
||||
|
||||
_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
|
||||
_url: str = _url.format(**path_format_arguments) # type: ignore
|
||||
|
||||
# Construct parameters
|
||||
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
||||
|
@ -184,7 +185,7 @@ def build_get_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview"))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
# Construct URL
|
||||
|
@ -193,7 +194,7 @@ def build_get_request(
|
|||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}",
|
||||
) # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
||||
"resourceGroupName": _SERIALIZER.url(
|
||||
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
|
||||
),
|
||||
|
@ -201,7 +202,7 @@ def build_get_request(
|
|||
"outboundEndpointName": _SERIALIZER.url("outbound_endpoint_name", outbound_endpoint_name, "str"),
|
||||
}
|
||||
|
||||
_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
|
||||
_url: str = _url.format(**path_format_arguments) # type: ignore
|
||||
|
||||
# Construct parameters
|
||||
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
||||
|
@ -218,7 +219,7 @@ def build_list_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview"))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
# Construct URL
|
||||
|
@ -227,14 +228,14 @@ def build_list_request(
|
|||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints",
|
||||
) # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
||||
"resourceGroupName": _SERIALIZER.url(
|
||||
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
|
||||
),
|
||||
"dnsResolverName": _SERIALIZER.url("dns_resolver_name", dns_resolver_name, "str"),
|
||||
}
|
||||
|
||||
_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
|
||||
_url: str = _url.format(**path_format_arguments) # type: ignore
|
||||
|
||||
# Construct parameters
|
||||
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
||||
|
@ -271,12 +272,12 @@ class OutboundEndpointsOperations:
|
|||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
outbound_endpoint_name: str,
|
||||
parameters: Union[_models.OutboundEndpoint, IO],
|
||||
parameters: Union[_models.OutboundEndpoint, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> Optional[_models.OutboundEndpoint]:
|
||||
error_map = {
|
||||
) -> Iterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -287,21 +288,19 @@ class OutboundEndpointsOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[Optional[_models.OutboundEndpoint]] = kwargs.pop("cls", None)
|
||||
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IO, bytes)):
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "OutboundEndpoint")
|
||||
|
||||
request = build_create_or_update_request(
|
||||
_request = build_create_or_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
outbound_endpoint_name=outbound_endpoint_name,
|
||||
|
@ -312,38 +311,33 @@ class OutboundEndpointsOperations:
|
|||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
template_url=self._create_or_update_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 201, 202]:
|
||||
try:
|
||||
response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = None
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize("OutboundEndpoint", pipeline_response)
|
||||
|
||||
if response.status_code == 201:
|
||||
deserialized = self._deserialize("OutboundEndpoint", pipeline_response)
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
_create_or_update_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
def begin_create_or_update(
|
||||
|
@ -380,14 +374,6 @@ class OutboundEndpointsOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either OutboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.OutboundEndpoint]
|
||||
|
@ -400,7 +386,7 @@ class OutboundEndpointsOperations:
|
|||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
outbound_endpoint_name: str,
|
||||
parameters: IO,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
*,
|
||||
|
@ -418,7 +404,7 @@ class OutboundEndpointsOperations:
|
|||
Required.
|
||||
:type outbound_endpoint_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Required.
|
||||
:type parameters: IO
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -429,14 +415,6 @@ class OutboundEndpointsOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either OutboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.OutboundEndpoint]
|
||||
|
@ -449,7 +427,7 @@ class OutboundEndpointsOperations:
|
|||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
outbound_endpoint_name: str,
|
||||
parameters: Union[_models.OutboundEndpoint, IO],
|
||||
parameters: Union[_models.OutboundEndpoint, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
|
@ -464,9 +442,9 @@ class OutboundEndpointsOperations:
|
|||
:param outbound_endpoint_name: The name of the outbound endpoint for the DNS resolver.
|
||||
Required.
|
||||
:type outbound_endpoint_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a model type
|
||||
or a IO type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.OutboundEndpoint or IO
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a
|
||||
OutboundEndpoint type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.OutboundEndpoint or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -474,17 +452,6 @@ class OutboundEndpointsOperations:
|
|||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either OutboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.OutboundEndpoint]
|
||||
|
@ -493,9 +460,7 @@ class OutboundEndpointsOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.OutboundEndpoint] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
|
||||
|
@ -516,12 +481,13 @@ class OutboundEndpointsOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("OutboundEndpoint", pipeline_response)
|
||||
deserialized = self._deserialize("OutboundEndpoint", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
|
@ -531,28 +497,26 @@ class OutboundEndpointsOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return LROPoller.from_continuation_token(
|
||||
return LROPoller[_models.OutboundEndpoint].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
begin_create_or_update.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"
|
||||
}
|
||||
return LROPoller[_models.OutboundEndpoint](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
def _update_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
outbound_endpoint_name: str,
|
||||
parameters: Union[_models.OutboundEndpointPatch, IO],
|
||||
parameters: Union[_models.OutboundEndpointPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> Optional[_models.OutboundEndpoint]:
|
||||
error_map = {
|
||||
) -> Iterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -563,21 +527,19 @@ class OutboundEndpointsOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[Optional[_models.OutboundEndpoint]] = kwargs.pop("cls", None)
|
||||
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IO, bytes)):
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "OutboundEndpointPatch")
|
||||
|
||||
request = build_update_request(
|
||||
_request = build_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
outbound_endpoint_name=outbound_endpoint_name,
|
||||
|
@ -587,35 +549,33 @@ class OutboundEndpointsOperations:
|
|||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
template_url=self._update_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 202]:
|
||||
try:
|
||||
response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = None
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize("OutboundEndpoint", pipeline_response)
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
_update_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
def begin_update(
|
||||
|
@ -648,14 +608,6 @@ class OutboundEndpointsOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either OutboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.OutboundEndpoint]
|
||||
|
@ -668,7 +620,7 @@ class OutboundEndpointsOperations:
|
|||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
outbound_endpoint_name: str,
|
||||
parameters: IO,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
|
@ -685,7 +637,7 @@ class OutboundEndpointsOperations:
|
|||
Required.
|
||||
:type outbound_endpoint_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Required.
|
||||
:type parameters: IO
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -693,14 +645,6 @@ class OutboundEndpointsOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either OutboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.OutboundEndpoint]
|
||||
|
@ -713,7 +657,7 @@ class OutboundEndpointsOperations:
|
|||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
outbound_endpoint_name: str,
|
||||
parameters: Union[_models.OutboundEndpointPatch, IO],
|
||||
parameters: Union[_models.OutboundEndpointPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> LROPoller[_models.OutboundEndpoint]:
|
||||
|
@ -727,24 +671,13 @@ class OutboundEndpointsOperations:
|
|||
:param outbound_endpoint_name: The name of the outbound endpoint for the DNS resolver.
|
||||
Required.
|
||||
:type outbound_endpoint_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a model type or a IO
|
||||
type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.OutboundEndpointPatch or IO
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a
|
||||
OutboundEndpointPatch type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.OutboundEndpointPatch or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either OutboundEndpoint or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.OutboundEndpoint]
|
||||
|
@ -753,9 +686,7 @@ class OutboundEndpointsOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.OutboundEndpoint] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
|
||||
|
@ -775,12 +706,13 @@ class OutboundEndpointsOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("OutboundEndpoint", pipeline_response)
|
||||
deserialized = self._deserialize("OutboundEndpoint", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
|
@ -790,27 +722,25 @@ class OutboundEndpointsOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return LROPoller.from_continuation_token(
|
||||
return LROPoller[_models.OutboundEndpoint].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
return LROPoller[_models.OutboundEndpoint](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
begin_update.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"
|
||||
}
|
||||
|
||||
def _delete_initial( # pylint: disable=inconsistent-return-statements
|
||||
def _delete_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_resolver_name: str,
|
||||
outbound_endpoint_name: str,
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> None:
|
||||
error_map = {
|
||||
) -> Iterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -821,41 +751,43 @@ class OutboundEndpointsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
request = build_delete_request(
|
||||
_request = build_delete_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
outbound_endpoint_name=outbound_endpoint_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
template_url=self._delete_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 202, 204]:
|
||||
try:
|
||||
response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
_delete_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"
|
||||
}
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def begin_delete(
|
||||
|
@ -880,14 +812,6 @@ class OutboundEndpointsOperations:
|
|||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either None or the result of cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[None]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -895,15 +819,13 @@ class OutboundEndpointsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
|
||||
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
||||
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
||||
if cont_token is None:
|
||||
raw_result = self._delete_initial( # type: ignore
|
||||
raw_result = self._delete_initial(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
outbound_endpoint_name=outbound_endpoint_name,
|
||||
|
@ -914,11 +836,12 @@ class OutboundEndpointsOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
return cls(pipeline_response, None, {}) # type: ignore
|
||||
|
||||
if polling is True:
|
||||
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
|
||||
|
@ -927,17 +850,13 @@ class OutboundEndpointsOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return LROPoller.from_continuation_token(
|
||||
return LROPoller[None].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
begin_delete.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"
|
||||
}
|
||||
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def get(
|
||||
|
@ -953,12 +872,11 @@ class OutboundEndpointsOperations:
|
|||
:param outbound_endpoint_name: The name of the outbound endpoint for the DNS resolver.
|
||||
Required.
|
||||
:type outbound_endpoint_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: OutboundEndpoint or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.OutboundEndpoint
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -969,26 +887,23 @@ class OutboundEndpointsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.OutboundEndpoint] = kwargs.pop("cls", None)
|
||||
|
||||
request = build_get_request(
|
||||
_request = build_get_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
outbound_endpoint_name=outbound_endpoint_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
api_version=api_version,
|
||||
template_url=self.get.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
@ -997,16 +912,12 @@ class OutboundEndpointsOperations:
|
|||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = self._deserialize("OutboundEndpoint", pipeline_response)
|
||||
deserialized = self._deserialize("OutboundEndpoint", pipeline_response.http_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
get.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def list(
|
||||
|
@ -1022,7 +933,6 @@ class OutboundEndpointsOperations:
|
|||
:param top: The maximum number of results to return. If not specified, returns up to 100
|
||||
results. Default value is None.
|
||||
:type top: int
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: An iterator like instance of either OutboundEndpoint or the result of cls(response)
|
||||
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dnsresolver.models.OutboundEndpoint]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -1030,12 +940,10 @@ class OutboundEndpointsOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.OutboundEndpointListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -1046,18 +954,16 @@ class OutboundEndpointsOperations:
|
|||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
request = build_list_request(
|
||||
_request = build_list_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_resolver_name=dns_resolver_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
top=top,
|
||||
api_version=api_version,
|
||||
template_url=self.list.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
|
@ -1069,13 +975,12 @@ class OutboundEndpointsOperations:
|
|||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
request = HttpRequest(
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
request.method = "GET"
|
||||
return request
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("OutboundEndpointListResult", pipeline_response)
|
||||
|
@ -1085,10 +990,11 @@ class OutboundEndpointsOperations:
|
|||
return deserialized.next_link or None, iter(list_of_elem)
|
||||
|
||||
def get_next(next_link=None):
|
||||
request = prepare_request(next_link)
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
|
@ -1099,7 +1005,3 @@ class OutboundEndpointsOperations:
|
|||
return pipeline_response
|
||||
|
||||
return ItemPaged(get_next, extract_data)
|
||||
|
||||
list.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints"
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# pylint: disable=too-many-lines
|
||||
# pylint: disable=too-many-lines,too-many-statements
|
||||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
@ -6,8 +6,9 @@
|
|||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
from io import IOBase
|
||||
import sys
|
||||
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
|
||||
from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
|
||||
import urllib.parse
|
||||
|
||||
from azure.core.exceptions import (
|
||||
|
@ -16,13 +17,14 @@ from azure.core.exceptions import (
|
|||
ResourceExistsError,
|
||||
ResourceNotFoundError,
|
||||
ResourceNotModifiedError,
|
||||
StreamClosedError,
|
||||
StreamConsumedError,
|
||||
map_error,
|
||||
)
|
||||
from azure.core.paging import ItemPaged
|
||||
from azure.core.pipeline import PipelineResponse
|
||||
from azure.core.pipeline.transport import HttpResponse
|
||||
from azure.core.polling import LROPoller, NoPolling, PollingMethod
|
||||
from azure.core.rest import HttpRequest
|
||||
from azure.core.rest import HttpRequest, HttpResponse
|
||||
from azure.core.tracing.decorator import distributed_trace
|
||||
from azure.core.utils import case_insensitive_dict
|
||||
from azure.mgmt.core.exceptions import ARMErrorFormat
|
||||
|
@ -30,12 +32,11 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling
|
|||
|
||||
from .. import models as _models
|
||||
from .._serialization import Serializer
|
||||
from .._vendor import _convert_request, _format_url_section
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
|
||||
if sys.version_info >= (3, 9):
|
||||
from collections.abc import MutableMapping
|
||||
else:
|
||||
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
|
||||
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
|
||||
T = TypeVar("T")
|
||||
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
|
||||
|
||||
|
@ -56,7 +57,7 @@ def build_create_or_update_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview"))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
|
@ -66,7 +67,7 @@ def build_create_or_update_request(
|
|||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}",
|
||||
) # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
||||
"resourceGroupName": _SERIALIZER.url(
|
||||
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
|
||||
),
|
||||
|
@ -74,7 +75,7 @@ def build_create_or_update_request(
|
|||
"virtualNetworkLinkName": _SERIALIZER.url("virtual_network_link_name", virtual_network_link_name, "str"),
|
||||
}
|
||||
|
||||
_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
|
||||
_url: str = _url.format(**path_format_arguments) # type: ignore
|
||||
|
||||
# Construct parameters
|
||||
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
||||
|
@ -103,7 +104,7 @@ def build_update_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview"))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
|
@ -113,7 +114,7 @@ def build_update_request(
|
|||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}",
|
||||
) # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
||||
"resourceGroupName": _SERIALIZER.url(
|
||||
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
|
||||
),
|
||||
|
@ -121,7 +122,7 @@ def build_update_request(
|
|||
"virtualNetworkLinkName": _SERIALIZER.url("virtual_network_link_name", virtual_network_link_name, "str"),
|
||||
}
|
||||
|
||||
_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
|
||||
_url: str = _url.format(**path_format_arguments) # type: ignore
|
||||
|
||||
# Construct parameters
|
||||
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
||||
|
@ -148,7 +149,7 @@ def build_delete_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview"))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
# Construct URL
|
||||
|
@ -157,7 +158,7 @@ def build_delete_request(
|
|||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}",
|
||||
) # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
||||
"resourceGroupName": _SERIALIZER.url(
|
||||
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
|
||||
),
|
||||
|
@ -165,7 +166,7 @@ def build_delete_request(
|
|||
"virtualNetworkLinkName": _SERIALIZER.url("virtual_network_link_name", virtual_network_link_name, "str"),
|
||||
}
|
||||
|
||||
_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
|
||||
_url: str = _url.format(**path_format_arguments) # type: ignore
|
||||
|
||||
# Construct parameters
|
||||
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
||||
|
@ -188,7 +189,7 @@ def build_get_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview"))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
# Construct URL
|
||||
|
@ -197,7 +198,7 @@ def build_get_request(
|
|||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}",
|
||||
) # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
||||
"resourceGroupName": _SERIALIZER.url(
|
||||
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
|
||||
),
|
||||
|
@ -205,7 +206,7 @@ def build_get_request(
|
|||
"virtualNetworkLinkName": _SERIALIZER.url("virtual_network_link_name", virtual_network_link_name, "str"),
|
||||
}
|
||||
|
||||
_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
|
||||
_url: str = _url.format(**path_format_arguments) # type: ignore
|
||||
|
||||
# Construct parameters
|
||||
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
||||
|
@ -227,7 +228,7 @@ def build_list_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview"))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
# Construct URL
|
||||
|
@ -236,14 +237,14 @@ def build_list_request(
|
|||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks",
|
||||
) # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
||||
"resourceGroupName": _SERIALIZER.url(
|
||||
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
|
||||
),
|
||||
"dnsForwardingRulesetName": _SERIALIZER.url("dns_forwarding_ruleset_name", dns_forwarding_ruleset_name, "str"),
|
||||
}
|
||||
|
||||
_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
|
||||
_url: str = _url.format(**path_format_arguments) # type: ignore
|
||||
|
||||
# Construct parameters
|
||||
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
||||
|
@ -280,12 +281,12 @@ class VirtualNetworkLinksOperations:
|
|||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
virtual_network_link_name: str,
|
||||
parameters: Union[_models.VirtualNetworkLink, IO],
|
||||
parameters: Union[_models.VirtualNetworkLink, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> Optional[_models.VirtualNetworkLink]:
|
||||
error_map = {
|
||||
) -> Iterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -296,21 +297,19 @@ class VirtualNetworkLinksOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[Optional[_models.VirtualNetworkLink]] = kwargs.pop("cls", None)
|
||||
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IO, bytes)):
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "VirtualNetworkLink")
|
||||
|
||||
request = build_create_or_update_request(
|
||||
_request = build_create_or_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
virtual_network_link_name=virtual_network_link_name,
|
||||
|
@ -321,38 +320,33 @@ class VirtualNetworkLinksOperations:
|
|||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
template_url=self._create_or_update_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 201, 202]:
|
||||
try:
|
||||
response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = None
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize("VirtualNetworkLink", pipeline_response)
|
||||
|
||||
if response.status_code == 201:
|
||||
deserialized = self._deserialize("VirtualNetworkLink", pipeline_response)
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
_create_or_update_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
def begin_create_or_update(
|
||||
|
@ -388,14 +382,6 @@ class VirtualNetworkLinksOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either VirtualNetworkLink or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.VirtualNetworkLink]
|
||||
|
@ -408,7 +394,7 @@ class VirtualNetworkLinksOperations:
|
|||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
virtual_network_link_name: str,
|
||||
parameters: IO,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
*,
|
||||
|
@ -425,7 +411,7 @@ class VirtualNetworkLinksOperations:
|
|||
:param virtual_network_link_name: The name of the virtual network link. Required.
|
||||
:type virtual_network_link_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Required.
|
||||
:type parameters: IO
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -436,14 +422,6 @@ class VirtualNetworkLinksOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either VirtualNetworkLink or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.VirtualNetworkLink]
|
||||
|
@ -456,7 +434,7 @@ class VirtualNetworkLinksOperations:
|
|||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
virtual_network_link_name: str,
|
||||
parameters: Union[_models.VirtualNetworkLink, IO],
|
||||
parameters: Union[_models.VirtualNetworkLink, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
if_none_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
|
@ -470,9 +448,9 @@ class VirtualNetworkLinksOperations:
|
|||
:type dns_forwarding_ruleset_name: str
|
||||
:param virtual_network_link_name: The name of the virtual network link. Required.
|
||||
:type virtual_network_link_name: str
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a model type
|
||||
or a IO type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.VirtualNetworkLink or IO
|
||||
:param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a
|
||||
VirtualNetworkLink type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.VirtualNetworkLink or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -480,17 +458,6 @@ class VirtualNetworkLinksOperations:
|
|||
:param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating
|
||||
an existing resource. Other values will be ignored. Default value is None.
|
||||
:type if_none_match: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either VirtualNetworkLink or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.VirtualNetworkLink]
|
||||
|
@ -499,9 +466,7 @@ class VirtualNetworkLinksOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.VirtualNetworkLink] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
|
||||
|
@ -522,12 +487,13 @@ class VirtualNetworkLinksOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("VirtualNetworkLink", pipeline_response)
|
||||
deserialized = self._deserialize("VirtualNetworkLink", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
|
@ -537,28 +503,26 @@ class VirtualNetworkLinksOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return LROPoller.from_continuation_token(
|
||||
return LROPoller[_models.VirtualNetworkLink].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
begin_create_or_update.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"
|
||||
}
|
||||
return LROPoller[_models.VirtualNetworkLink](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
def _update_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
virtual_network_link_name: str,
|
||||
parameters: Union[_models.VirtualNetworkLinkPatch, IO],
|
||||
parameters: Union[_models.VirtualNetworkLinkPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> Optional[_models.VirtualNetworkLink]:
|
||||
error_map = {
|
||||
) -> Iterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -569,21 +533,19 @@ class VirtualNetworkLinksOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[Optional[_models.VirtualNetworkLink]] = kwargs.pop("cls", None)
|
||||
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
content_type = content_type or "application/json"
|
||||
_json = None
|
||||
_content = None
|
||||
if isinstance(parameters, (IO, bytes)):
|
||||
if isinstance(parameters, (IOBase, bytes)):
|
||||
_content = parameters
|
||||
else:
|
||||
_json = self._serialize.body(parameters, "VirtualNetworkLinkPatch")
|
||||
|
||||
request = build_update_request(
|
||||
_request = build_update_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
virtual_network_link_name=virtual_network_link_name,
|
||||
|
@ -593,35 +555,33 @@ class VirtualNetworkLinksOperations:
|
|||
content_type=content_type,
|
||||
json=_json,
|
||||
content=_content,
|
||||
template_url=self._update_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 202]:
|
||||
try:
|
||||
response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = None
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize("VirtualNetworkLink", pipeline_response)
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
_update_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@overload
|
||||
def begin_update(
|
||||
|
@ -653,14 +613,6 @@ class VirtualNetworkLinksOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either VirtualNetworkLink or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.VirtualNetworkLink]
|
||||
|
@ -673,7 +625,7 @@ class VirtualNetworkLinksOperations:
|
|||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
virtual_network_link_name: str,
|
||||
parameters: IO,
|
||||
parameters: IO[bytes],
|
||||
if_match: Optional[str] = None,
|
||||
*,
|
||||
content_type: str = "application/json",
|
||||
|
@ -689,7 +641,7 @@ class VirtualNetworkLinksOperations:
|
|||
:param virtual_network_link_name: The name of the virtual network link. Required.
|
||||
:type virtual_network_link_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Required.
|
||||
:type parameters: IO
|
||||
:type parameters: IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
|
@ -697,14 +649,6 @@ class VirtualNetworkLinksOperations:
|
|||
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
||||
Default value is "application/json".
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either VirtualNetworkLink or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.VirtualNetworkLink]
|
||||
|
@ -717,7 +661,7 @@ class VirtualNetworkLinksOperations:
|
|||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
virtual_network_link_name: str,
|
||||
parameters: Union[_models.VirtualNetworkLinkPatch, IO],
|
||||
parameters: Union[_models.VirtualNetworkLinkPatch, IO[bytes]],
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> LROPoller[_models.VirtualNetworkLink]:
|
||||
|
@ -730,24 +674,13 @@ class VirtualNetworkLinksOperations:
|
|||
:type dns_forwarding_ruleset_name: str
|
||||
:param virtual_network_link_name: The name of the virtual network link. Required.
|
||||
:type virtual_network_link_name: str
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a model type or a IO
|
||||
type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.VirtualNetworkLinkPatch or IO
|
||||
:param parameters: Parameters supplied to the Update operation. Is either a
|
||||
VirtualNetworkLinkPatch type or a IO[bytes] type. Required.
|
||||
:type parameters: ~azure.mgmt.dnsresolver.models.VirtualNetworkLinkPatch or IO[bytes]
|
||||
:param if_match: ETag of the resource. Omit this value to always overwrite the current
|
||||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either VirtualNetworkLink or the result of
|
||||
cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.VirtualNetworkLink]
|
||||
|
@ -756,9 +689,7 @@ class VirtualNetworkLinksOperations:
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
cls: ClsType[_models.VirtualNetworkLink] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
|
||||
|
@ -778,12 +709,13 @@ class VirtualNetworkLinksOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response):
|
||||
deserialized = self._deserialize("VirtualNetworkLink", pipeline_response)
|
||||
deserialized = self._deserialize("VirtualNetworkLink", pipeline_response.http_response)
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
return deserialized
|
||||
|
||||
if polling is True:
|
||||
|
@ -793,27 +725,25 @@ class VirtualNetworkLinksOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return LROPoller.from_continuation_token(
|
||||
return LROPoller[_models.VirtualNetworkLink].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
return LROPoller[_models.VirtualNetworkLink](
|
||||
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
||||
)
|
||||
|
||||
begin_update.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"
|
||||
}
|
||||
|
||||
def _delete_initial( # pylint: disable=inconsistent-return-statements
|
||||
def _delete_initial(
|
||||
self,
|
||||
resource_group_name: str,
|
||||
dns_forwarding_ruleset_name: str,
|
||||
virtual_network_link_name: str,
|
||||
if_match: Optional[str] = None,
|
||||
**kwargs: Any
|
||||
) -> None:
|
||||
error_map = {
|
||||
) -> Iterator[bytes]:
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -824,41 +754,43 @@ class VirtualNetworkLinksOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
|
||||
|
||||
request = build_delete_request(
|
||||
_request = build_delete_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
virtual_network_link_name=virtual_network_link_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
if_match=if_match,
|
||||
api_version=api_version,
|
||||
template_url=self._delete_initial.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_decompress = kwargs.pop("decompress", True)
|
||||
_stream = True
|
||||
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 202, 204]:
|
||||
try:
|
||||
response.read() # Load the body in memory and close the socket
|
||||
except (StreamConsumedError, StreamClosedError):
|
||||
pass
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
||||
|
||||
_delete_initial.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"
|
||||
}
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def begin_delete(
|
||||
|
@ -883,14 +815,6 @@ class VirtualNetworkLinksOperations:
|
|||
resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent
|
||||
changes. Default value is None.
|
||||
:type if_match: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
||||
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
|
||||
operation to not poll, or pass in your own initialized polling object for a personal polling
|
||||
strategy.
|
||||
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
||||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
||||
Retry-After header is present.
|
||||
:return: An instance of LROPoller that returns either None or the result of cls(response)
|
||||
:rtype: ~azure.core.polling.LROPoller[None]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -898,15 +822,13 @@ class VirtualNetworkLinksOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[None] = kwargs.pop("cls", None)
|
||||
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
|
||||
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
||||
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
||||
if cont_token is None:
|
||||
raw_result = self._delete_initial( # type: ignore
|
||||
raw_result = self._delete_initial(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
virtual_network_link_name=virtual_network_link_name,
|
||||
|
@ -917,11 +839,12 @@ class VirtualNetworkLinksOperations:
|
|||
params=_params,
|
||||
**kwargs
|
||||
)
|
||||
raw_result.http_response.read() # type: ignore
|
||||
kwargs.pop("error_map", None)
|
||||
|
||||
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
return cls(pipeline_response, None, {}) # type: ignore
|
||||
|
||||
if polling is True:
|
||||
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
|
||||
|
@ -930,17 +853,13 @@ class VirtualNetworkLinksOperations:
|
|||
else:
|
||||
polling_method = polling
|
||||
if cont_token:
|
||||
return LROPoller.from_continuation_token(
|
||||
return LROPoller[None].from_continuation_token(
|
||||
polling_method=polling_method,
|
||||
continuation_token=cont_token,
|
||||
client=self._client,
|
||||
deserialization_callback=get_long_running_output,
|
||||
)
|
||||
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
begin_delete.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"
|
||||
}
|
||||
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def get(
|
||||
|
@ -955,12 +874,11 @@ class VirtualNetworkLinksOperations:
|
|||
:type dns_forwarding_ruleset_name: str
|
||||
:param virtual_network_link_name: The name of the virtual network link. Required.
|
||||
:type virtual_network_link_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: VirtualNetworkLink or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.dnsresolver.models.VirtualNetworkLink
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
"""
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -971,26 +889,23 @@ class VirtualNetworkLinksOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.VirtualNetworkLink] = kwargs.pop("cls", None)
|
||||
|
||||
request = build_get_request(
|
||||
_request = build_get_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
virtual_network_link_name=virtual_network_link_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
api_version=api_version,
|
||||
template_url=self.get.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
|
||||
response = pipeline_response.http_response
|
||||
|
@ -999,16 +914,12 @@ class VirtualNetworkLinksOperations:
|
|||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = self._deserialize("VirtualNetworkLink", pipeline_response)
|
||||
deserialized = self._deserialize("VirtualNetworkLink", pipeline_response.http_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
return cls(pipeline_response, deserialized, {}) # type: ignore
|
||||
|
||||
return deserialized
|
||||
|
||||
get.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"
|
||||
}
|
||||
return deserialized # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def list(
|
||||
|
@ -1024,7 +935,6 @@ class VirtualNetworkLinksOperations:
|
|||
:param top: The maximum number of results to return. If not specified, returns up to 100
|
||||
results. Default value is None.
|
||||
:type top: int
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: An iterator like instance of either VirtualNetworkLink or the result of cls(response)
|
||||
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dnsresolver.models.VirtualNetworkLink]
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -1032,12 +942,10 @@ class VirtualNetworkLinksOperations:
|
|||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: Literal["2022-07-01"] = kwargs.pop(
|
||||
"api_version", _params.pop("api-version", self._config.api_version)
|
||||
)
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
|
||||
cls: ClsType[_models.VirtualNetworkLinkListResult] = kwargs.pop("cls", None)
|
||||
|
||||
error_map = {
|
||||
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
||||
401: ClientAuthenticationError,
|
||||
404: ResourceNotFoundError,
|
||||
409: ResourceExistsError,
|
||||
|
@ -1048,18 +956,16 @@ class VirtualNetworkLinksOperations:
|
|||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
request = build_list_request(
|
||||
_request = build_list_request(
|
||||
resource_group_name=resource_group_name,
|
||||
dns_forwarding_ruleset_name=dns_forwarding_ruleset_name,
|
||||
subscription_id=self._config.subscription_id,
|
||||
top=top,
|
||||
api_version=api_version,
|
||||
template_url=self.list.metadata["url"],
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
# make call to next link with the client's api-version
|
||||
|
@ -1071,13 +977,12 @@ class VirtualNetworkLinksOperations:
|
|||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
request = HttpRequest(
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
request.method = "GET"
|
||||
return request
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
_request.method = "GET"
|
||||
return _request
|
||||
|
||||
def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("VirtualNetworkLinkListResult", pipeline_response)
|
||||
|
@ -1087,10 +992,11 @@ class VirtualNetworkLinksOperations:
|
|||
return deserialized.next_link or None, iter(list_of_elem)
|
||||
|
||||
def get_next(next_link=None):
|
||||
request = prepare_request(next_link)
|
||||
_request = prepare_request(next_link)
|
||||
|
||||
_stream = False
|
||||
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request, stream=False, **kwargs
|
||||
_request, stream=_stream, **kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
|
@ -1101,7 +1007,3 @@ class VirtualNetworkLinksOperations:
|
|||
return pipeline_response
|
||||
|
||||
return ItemPaged(get_next, extract_data)
|
||||
|
||||
list.metadata = {
|
||||
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks"
|
||||
}
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
-e ../../../tools/azure-sdk-tools
|
||||
aiohttp
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -29,13 +30,12 @@ def main():
|
|||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_forwarding_rulesets.begin_delete(
|
||||
client.dns_forwarding_rulesets.begin_delete(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_forwarding_ruleset_name="samplednsForwardingRulesetName",
|
||||
).result()
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/DnsForwardingRuleset_Delete.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsForwardingRuleset_Delete.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -36,6 +37,6 @@ def main():
|
|||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/DnsForwardingRuleset_Get.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsForwardingRuleset_Get.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -36,6 +37,6 @@ def main():
|
|||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/DnsForwardingRuleset_ListByResourceGroup.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsForwardingRuleset_ListByResourceGroup.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -34,6 +35,6 @@ def main():
|
|||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/DnsForwardingRuleset_ListBySubscription.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsForwardingRuleset_ListBySubscription.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -37,6 +38,6 @@ def main():
|
|||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/DnsForwardingRuleset_ListByVirtualNetwork.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsForwardingRuleset_ListByVirtualNetwork.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -37,6 +38,6 @@ def main():
|
|||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/DnsForwardingRuleset_Patch.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsForwardingRuleset_Patch.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -50,6 +51,6 @@ def main():
|
|||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/DnsForwardingRuleset_Put.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsForwardingRuleset_Put.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -29,13 +30,12 @@ def main():
|
|||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_resolvers.begin_delete(
|
||||
client.dns_resolvers.begin_delete(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_name="sampleDnsResolver",
|
||||
).result()
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/DnsResolver_Delete.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolver_Delete.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_resolver_domain_list_delete.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
client.dns_resolver_domain_lists.begin_delete(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_domain_list_name="sampleDnsResolverDomainList",
|
||||
).result()
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolverDomainList_Delete.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,42 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_resolver_domain_list_get.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_resolver_domain_lists.get(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_domain_list_name="sampleDnsResolverDomainList",
|
||||
)
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolverDomainList_Get.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,42 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_resolver_domain_list_list_by_resource_group.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_resolver_domain_lists.list_by_resource_group(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
)
|
||||
for item in response:
|
||||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolverDomainList_ListByResourceGroup.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,40 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_resolver_domain_list_list_by_subscription.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_resolver_domain_lists.list()
|
||||
for item in response:
|
||||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolverDomainList_ListBySubscription.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,43 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_resolver_domain_list_patch.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_resolver_domain_lists.begin_update(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_domain_list_name="sampleDnsResolverDomainList",
|
||||
parameters={"properties": {"domains": ["contoso.com"]}, "tags": {"key1": "value1"}},
|
||||
).result()
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolverDomainList_Patch.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,43 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_resolver_domain_list_put.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_resolver_domain_lists.begin_create_or_update(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_domain_list_name="sampleDnsResolverDomainList",
|
||||
parameters={"location": "westus2", "properties": {"domains": ["contoso.com"]}, "tags": {"key1": "value1"}},
|
||||
).result()
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolverDomainList_Put.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -36,6 +37,6 @@ def main():
|
|||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/DnsResolver_Get.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolver_Get.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -36,6 +37,6 @@ def main():
|
|||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/DnsResolver_ListByResourceGroup.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolver_ListByResourceGroup.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -34,6 +35,6 @@ def main():
|
|||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/DnsResolver_ListBySubscription.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolver_ListBySubscription.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -37,6 +38,6 @@ def main():
|
|||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/DnsResolver_ListByVirtualNetwork.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolver_ListByVirtualNetwork.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -37,6 +38,6 @@ def main():
|
|||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/DnsResolver_Patch.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolver_Patch.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_resolver_policy_delete.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
client.dns_resolver_policies.begin_delete(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_policy_name="sampleDnsResolverPolicy",
|
||||
).result()
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolverPolicy_Delete.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,42 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_resolver_policy_get.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_resolver_policies.get(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_policy_name="sampleDnsResolverPolicy",
|
||||
)
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolverPolicy_Get.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,42 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_resolver_policy_list_by_resource_group.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_resolver_policies.list_by_resource_group(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
)
|
||||
for item in response:
|
||||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolverPolicy_ListByResourceGroup.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,40 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_resolver_policy_list_by_subscription.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_resolver_policies.list()
|
||||
for item in response:
|
||||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolverPolicy_ListBySubscription.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,43 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_resolver_policy_list_by_virtual_network.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_resolver_policies.list_by_virtual_network(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
virtual_network_name="sampleVirtualNetwork",
|
||||
)
|
||||
for item in response:
|
||||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolverPolicy_ListByVirtualNetwork.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,43 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_resolver_policy_patch.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_resolver_policies.begin_update(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_policy_name="sampleDnsResolverPolicy",
|
||||
parameters={"tags": {"key1": "value1"}},
|
||||
).result()
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolverPolicy_Patch.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,43 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_resolver_policy_put.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_resolver_policies.begin_create_or_update(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_policy_name="sampleDnsResolverPolicy",
|
||||
parameters={"location": "westus2", "tags": {"key1": "value1"}},
|
||||
).result()
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolverPolicy_Put.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,42 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_resolver_policy_virtual_network_link_delete.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
client.dns_resolver_policy_virtual_network_links.begin_delete(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_policy_name="sampleDnsResolverPolicy",
|
||||
dns_resolver_policy_virtual_network_link_name="sampleVirtualNetworkLink",
|
||||
).result()
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolverPolicyVirtualNetworkLink_Delete.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,43 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_resolver_policy_virtual_network_link_get.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_resolver_policy_virtual_network_links.get(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_policy_name="sampleDnsResolverPolicy",
|
||||
dns_resolver_policy_virtual_network_link_name="sampleVirtualNetworkLink",
|
||||
)
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolverPolicyVirtualNetworkLink_Get.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,43 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_resolver_policy_virtual_network_link_list.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_resolver_policy_virtual_network_links.list(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_policy_name="sampleDnsResolverPolicy",
|
||||
)
|
||||
for item in response:
|
||||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolverPolicyVirtualNetworkLink_List.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,44 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_resolver_policy_virtual_network_link_patch.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_resolver_policy_virtual_network_links.begin_update(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_policy_name="sampleDnsResolverPolicy",
|
||||
dns_resolver_policy_virtual_network_link_name="sampleVirtualNetworkLink",
|
||||
parameters={"tags": {"key1": "value1"}},
|
||||
).result()
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolverPolicyVirtualNetworkLink_Patch.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,52 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_resolver_policy_virtual_network_link_put.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_resolver_policy_virtual_network_links.begin_create_or_update(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_policy_name="sampleDnsResolverPolicy",
|
||||
dns_resolver_policy_virtual_network_link_name="sampleVirtualNetworkLink",
|
||||
parameters={
|
||||
"location": "westus2",
|
||||
"properties": {
|
||||
"virtualNetwork": {
|
||||
"id": "/subscriptions/0403cfa9-9659-4f33-9f30-1f191c51d111/resourceGroups/sampleVnetResourceGroupName/providers/Microsoft.Network/virtualNetworks/sampleVirtualNetwork"
|
||||
}
|
||||
},
|
||||
"tags": {"key1": "value1"},
|
||||
},
|
||||
).result()
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolverPolicyVirtualNetworkLink_Put.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -45,6 +46,6 @@ def main():
|
|||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/DnsResolver_Put.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsResolver_Put.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_security_rule_delete.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
client.dns_security_rules.begin_delete(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_policy_name="sampleDnsDnsResolverPolicy",
|
||||
dns_security_rule_name="sampleDnsSecurityRule",
|
||||
).result()
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsSecurityRule_Delete.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,43 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_security_rule_get.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_security_rules.get(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_policy_name="sampleDnsResolverPolicy",
|
||||
dns_security_rule_name="sampleDnsSecurityRule",
|
||||
)
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsSecurityRule_Get.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,43 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_security_rule_list.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_security_rules.list(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_policy_name="sampleDnsResolverPolicy",
|
||||
)
|
||||
for item in response:
|
||||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsSecurityRule_List.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,44 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_security_rule_patch.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_security_rules.begin_update(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_policy_name="sampleDnsResolverPolicy",
|
||||
dns_security_rule_name="sampleDnsSecurityRule",
|
||||
parameters={"properties": {"dnsSecurityRuleState": "Disabled"}, "tags": {"key1": "value1"}},
|
||||
).result()
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsSecurityRule_Patch.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,57 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-dnsresolver
|
||||
# USAGE
|
||||
python dns_security_rule_put.py
|
||||
|
||||
Before run the sample, please set the values of the client ID, tenant ID and client secret
|
||||
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
|
||||
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
|
||||
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
client = DnsResolverManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.dns_security_rules.begin_create_or_update(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_policy_name="sampleDnsResolverPolicy",
|
||||
dns_security_rule_name="sampleDnsSecurityRule",
|
||||
parameters={
|
||||
"location": "westus2",
|
||||
"properties": {
|
||||
"action": {"actionType": "Block", "blockResponseCode": "SERVFAIL"},
|
||||
"dnsResolverDomainLists": [
|
||||
{
|
||||
"id": "/subscriptions/abdd4249-9f34-4cc6-8e42-c2e32110603e/resourceGroups/sampleResourceGroup/providers/Microsoft.Network/dnsResolverDomainLists/sampleDnsResolverDomainList"
|
||||
}
|
||||
],
|
||||
"dnsSecurityRuleState": "Enabled",
|
||||
"priority": 100,
|
||||
},
|
||||
"tags": {"key1": "value1"},
|
||||
},
|
||||
).result()
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DnsSecurityRule_Put.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -29,14 +30,13 @@ def main():
|
|||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.forwarding_rules.delete(
|
||||
client.forwarding_rules.delete(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_forwarding_ruleset_name="sampleDnsForwardingRuleset",
|
||||
forwarding_rule_name="sampleForwardingRule",
|
||||
)
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/ForwardingRule_Delete.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/ForwardingRule_Delete.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -37,6 +38,6 @@ def main():
|
|||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/ForwardingRule_Get.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/ForwardingRule_Get.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -37,6 +38,6 @@ def main():
|
|||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/ForwardingRule_List.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/ForwardingRule_List.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -38,6 +39,6 @@ def main():
|
|||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/ForwardingRule_Patch.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/ForwardingRule_Patch.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -45,6 +46,6 @@ def main():
|
|||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/ForwardingRule_Put.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/ForwardingRule_Put.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -29,14 +30,13 @@ def main():
|
|||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.inbound_endpoints.begin_delete(
|
||||
client.inbound_endpoints.begin_delete(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_name="sampleDnsResolver",
|
||||
inbound_endpoint_name="sampleInboundEndpoint",
|
||||
).result()
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/InboundEndpoint_Delete.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/InboundEndpoint_Delete.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -37,6 +38,6 @@ def main():
|
|||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/InboundEndpoint_Get.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/InboundEndpoint_Get.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -37,6 +38,6 @@ def main():
|
|||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/InboundEndpoint_List.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/InboundEndpoint_List.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -38,6 +39,6 @@ def main():
|
|||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/InboundEndpoint_Patch.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/InboundEndpoint_Patch.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -51,6 +52,6 @@ def main():
|
|||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/InboundEndpoint_Put.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/InboundEndpoint_Put.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -29,14 +30,13 @@ def main():
|
|||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.outbound_endpoints.begin_delete(
|
||||
client.outbound_endpoints.begin_delete(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_resolver_name="sampleDnsResolver",
|
||||
outbound_endpoint_name="sampleOutboundEndpoint",
|
||||
).result()
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/OutboundEndpoint_Delete.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/OutboundEndpoint_Delete.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -37,6 +38,6 @@ def main():
|
|||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/OutboundEndpoint_Get.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/OutboundEndpoint_Get.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -37,6 +38,6 @@ def main():
|
|||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/OutboundEndpoint_List.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/OutboundEndpoint_List.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -38,6 +39,6 @@ def main():
|
|||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/OutboundEndpoint_Patch.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/OutboundEndpoint_Patch.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -46,6 +47,6 @@ def main():
|
|||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/OutboundEndpoint_Put.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/OutboundEndpoint_Put.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -29,14 +30,13 @@ def main():
|
|||
subscription_id="abdd4249-9f34-4cc6-8e42-c2e32110603e",
|
||||
)
|
||||
|
||||
response = client.virtual_network_links.begin_delete(
|
||||
client.virtual_network_links.begin_delete(
|
||||
resource_group_name="sampleResourceGroup",
|
||||
dns_forwarding_ruleset_name="sampleDnsForwardingRuleset",
|
||||
virtual_network_link_name="sampleVirtualNetworkLink",
|
||||
).result()
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/VirtualNetworkLink_Delete.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/VirtualNetworkLink_Delete.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -37,6 +38,6 @@ def main():
|
|||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/VirtualNetworkLink_Get.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/VirtualNetworkLink_Get.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -37,6 +38,6 @@ def main():
|
|||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/VirtualNetworkLink_List.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/VirtualNetworkLink_List.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -38,6 +39,6 @@ def main():
|
|||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/VirtualNetworkLink_Patch.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/VirtualNetworkLink_Patch.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
"""
|
||||
|
@ -45,6 +46,6 @@ def main():
|
|||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/stable/2022-07-01/examples/VirtualNetworkLink_Put.json
|
||||
# x-ms-original-file: specification/dnsresolver/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/VirtualNetworkLink_Put.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
import os
|
||||
import pytest
|
||||
from dotenv import load_dotenv
|
||||
from devtools_testutils import (
|
||||
test_proxy,
|
||||
add_general_regex_sanitizer,
|
||||
add_body_key_sanitizer,
|
||||
add_header_regex_sanitizer,
|
||||
)
|
||||
|
||||
load_dotenv()
|
||||
|
||||
|
||||
# aovid record sensitive identity information in recordings
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def add_sanitizers(test_proxy):
|
||||
dnsresolvermanagement_subscription_id = os.environ.get(
|
||||
"AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000"
|
||||
)
|
||||
dnsresolvermanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000")
|
||||
dnsresolvermanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
|
||||
dnsresolvermanagement_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000")
|
||||
add_general_regex_sanitizer(
|
||||
regex=dnsresolvermanagement_subscription_id, value="00000000-0000-0000-0000-000000000000"
|
||||
)
|
||||
add_general_regex_sanitizer(regex=dnsresolvermanagement_tenant_id, value="00000000-0000-0000-0000-000000000000")
|
||||
add_general_regex_sanitizer(regex=dnsresolvermanagement_client_id, value="00000000-0000-0000-0000-000000000000")
|
||||
add_general_regex_sanitizer(regex=dnsresolvermanagement_client_secret, value="00000000-0000-0000-0000-000000000000")
|
||||
|
||||
add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
|
||||
add_header_regex_sanitizer(key="Cookie", value="cookie;")
|
||||
add_body_key_sanitizer(json_path="$..access_token", value="access_token")
|
|
@ -0,0 +1,120 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
import pytest
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
|
||||
|
||||
AZURE_LOCATION = "eastus"
|
||||
|
||||
|
||||
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
|
||||
class TestDnsResolverManagementDnsForwardingRulesetsOperations(AzureMgmtRecordedTestCase):
|
||||
def setup_method(self, method):
|
||||
self.client = self.create_mgmt_client(DnsResolverManagementClient)
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy
|
||||
def test_begin_create_or_update(self, resource_group):
|
||||
response = self.client.dns_forwarding_rulesets.begin_create_or_update(
|
||||
resource_group_name=resource_group.name,
|
||||
dns_forwarding_ruleset_name="str",
|
||||
parameters={
|
||||
"dnsResolverOutboundEndpoints": [{"id": "str"}],
|
||||
"location": "str",
|
||||
"etag": "str",
|
||||
"id": "str",
|
||||
"name": "str",
|
||||
"provisioningState": "str",
|
||||
"resourceGuid": "str",
|
||||
"systemData": {
|
||||
"createdAt": "2020-02-20 00:00:00",
|
||||
"createdBy": "str",
|
||||
"createdByType": "str",
|
||||
"lastModifiedAt": "2020-02-20 00:00:00",
|
||||
"lastModifiedBy": "str",
|
||||
"lastModifiedByType": "str",
|
||||
},
|
||||
"tags": {"str": "str"},
|
||||
"type": "str",
|
||||
},
|
||||
api_version="2023-07-01-preview",
|
||||
).result() # call '.result()' to poll until service return final result
|
||||
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy
|
||||
def test_begin_update(self, resource_group):
|
||||
response = self.client.dns_forwarding_rulesets.begin_update(
|
||||
resource_group_name=resource_group.name,
|
||||
dns_forwarding_ruleset_name="str",
|
||||
parameters={"dnsResolverOutboundEndpoints": [{"id": "str"}], "tags": {"str": "str"}},
|
||||
api_version="2023-07-01-preview",
|
||||
).result() # call '.result()' to poll until service return final result
|
||||
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy
|
||||
def test_begin_delete(self, resource_group):
|
||||
response = self.client.dns_forwarding_rulesets.begin_delete(
|
||||
resource_group_name=resource_group.name,
|
||||
dns_forwarding_ruleset_name="str",
|
||||
api_version="2023-07-01-preview",
|
||||
).result() # call '.result()' to poll until service return final result
|
||||
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy
|
||||
def test_get(self, resource_group):
|
||||
response = self.client.dns_forwarding_rulesets.get(
|
||||
resource_group_name=resource_group.name,
|
||||
dns_forwarding_ruleset_name="str",
|
||||
api_version="2023-07-01-preview",
|
||||
)
|
||||
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy
|
||||
def test_list_by_resource_group(self, resource_group):
|
||||
response = self.client.dns_forwarding_rulesets.list_by_resource_group(
|
||||
resource_group_name=resource_group.name,
|
||||
api_version="2023-07-01-preview",
|
||||
)
|
||||
result = [r for r in response]
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy
|
||||
def test_list(self, resource_group):
|
||||
response = self.client.dns_forwarding_rulesets.list(
|
||||
api_version="2023-07-01-preview",
|
||||
)
|
||||
result = [r for r in response]
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy
|
||||
def test_list_by_virtual_network(self, resource_group):
|
||||
response = self.client.dns_forwarding_rulesets.list_by_virtual_network(
|
||||
resource_group_name=resource_group.name,
|
||||
virtual_network_name="str",
|
||||
api_version="2023-07-01-preview",
|
||||
)
|
||||
result = [r for r in response]
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
|
@ -0,0 +1,127 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
import pytest
|
||||
from azure.mgmt.dnsresolver.aio import DnsResolverManagementClient
|
||||
|
||||
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
|
||||
from devtools_testutils.aio import recorded_by_proxy_async
|
||||
|
||||
AZURE_LOCATION = "eastus"
|
||||
|
||||
|
||||
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
|
||||
class TestDnsResolverManagementDnsForwardingRulesetsOperationsAsync(AzureMgmtRecordedTestCase):
|
||||
def setup_method(self, method):
|
||||
self.client = self.create_mgmt_client(DnsResolverManagementClient, is_async=True)
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy_async
|
||||
async def test_begin_create_or_update(self, resource_group):
|
||||
response = await (
|
||||
await self.client.dns_forwarding_rulesets.begin_create_or_update(
|
||||
resource_group_name=resource_group.name,
|
||||
dns_forwarding_ruleset_name="str",
|
||||
parameters={
|
||||
"dnsResolverOutboundEndpoints": [{"id": "str"}],
|
||||
"location": "str",
|
||||
"etag": "str",
|
||||
"id": "str",
|
||||
"name": "str",
|
||||
"provisioningState": "str",
|
||||
"resourceGuid": "str",
|
||||
"systemData": {
|
||||
"createdAt": "2020-02-20 00:00:00",
|
||||
"createdBy": "str",
|
||||
"createdByType": "str",
|
||||
"lastModifiedAt": "2020-02-20 00:00:00",
|
||||
"lastModifiedBy": "str",
|
||||
"lastModifiedByType": "str",
|
||||
},
|
||||
"tags": {"str": "str"},
|
||||
"type": "str",
|
||||
},
|
||||
api_version="2023-07-01-preview",
|
||||
)
|
||||
).result() # call '.result()' to poll until service return final result
|
||||
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy_async
|
||||
async def test_begin_update(self, resource_group):
|
||||
response = await (
|
||||
await self.client.dns_forwarding_rulesets.begin_update(
|
||||
resource_group_name=resource_group.name,
|
||||
dns_forwarding_ruleset_name="str",
|
||||
parameters={"dnsResolverOutboundEndpoints": [{"id": "str"}], "tags": {"str": "str"}},
|
||||
api_version="2023-07-01-preview",
|
||||
)
|
||||
).result() # call '.result()' to poll until service return final result
|
||||
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy_async
|
||||
async def test_begin_delete(self, resource_group):
|
||||
response = await (
|
||||
await self.client.dns_forwarding_rulesets.begin_delete(
|
||||
resource_group_name=resource_group.name,
|
||||
dns_forwarding_ruleset_name="str",
|
||||
api_version="2023-07-01-preview",
|
||||
)
|
||||
).result() # call '.result()' to poll until service return final result
|
||||
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy_async
|
||||
async def test_get(self, resource_group):
|
||||
response = await self.client.dns_forwarding_rulesets.get(
|
||||
resource_group_name=resource_group.name,
|
||||
dns_forwarding_ruleset_name="str",
|
||||
api_version="2023-07-01-preview",
|
||||
)
|
||||
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy_async
|
||||
async def test_list_by_resource_group(self, resource_group):
|
||||
response = self.client.dns_forwarding_rulesets.list_by_resource_group(
|
||||
resource_group_name=resource_group.name,
|
||||
api_version="2023-07-01-preview",
|
||||
)
|
||||
result = [r async for r in response]
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy_async
|
||||
async def test_list(self, resource_group):
|
||||
response = self.client.dns_forwarding_rulesets.list(
|
||||
api_version="2023-07-01-preview",
|
||||
)
|
||||
result = [r async for r in response]
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy_async
|
||||
async def test_list_by_virtual_network(self, resource_group):
|
||||
response = self.client.dns_forwarding_rulesets.list_by_virtual_network(
|
||||
resource_group_name=resource_group.name,
|
||||
virtual_network_name="str",
|
||||
api_version="2023-07-01-preview",
|
||||
)
|
||||
result = [r async for r in response]
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
|
@ -0,0 +1,108 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
import pytest
|
||||
from azure.mgmt.dnsresolver import DnsResolverManagementClient
|
||||
|
||||
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
|
||||
|
||||
AZURE_LOCATION = "eastus"
|
||||
|
||||
|
||||
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
|
||||
class TestDnsResolverManagementDnsResolverDomainListsOperations(AzureMgmtRecordedTestCase):
|
||||
def setup_method(self, method):
|
||||
self.client = self.create_mgmt_client(DnsResolverManagementClient)
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy
|
||||
def test_begin_create_or_update(self, resource_group):
|
||||
response = self.client.dns_resolver_domain_lists.begin_create_or_update(
|
||||
resource_group_name=resource_group.name,
|
||||
dns_resolver_domain_list_name="str",
|
||||
parameters={
|
||||
"domains": ["str"],
|
||||
"location": "str",
|
||||
"etag": "str",
|
||||
"id": "str",
|
||||
"name": "str",
|
||||
"provisioningState": "str",
|
||||
"resourceGuid": "str",
|
||||
"systemData": {
|
||||
"createdAt": "2020-02-20 00:00:00",
|
||||
"createdBy": "str",
|
||||
"createdByType": "str",
|
||||
"lastModifiedAt": "2020-02-20 00:00:00",
|
||||
"lastModifiedBy": "str",
|
||||
"lastModifiedByType": "str",
|
||||
},
|
||||
"tags": {"str": "str"},
|
||||
"type": "str",
|
||||
},
|
||||
api_version="2023-07-01-preview",
|
||||
).result() # call '.result()' to poll until service return final result
|
||||
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy
|
||||
def test_begin_update(self, resource_group):
|
||||
response = self.client.dns_resolver_domain_lists.begin_update(
|
||||
resource_group_name=resource_group.name,
|
||||
dns_resolver_domain_list_name="str",
|
||||
parameters={"domains": ["str"], "tags": {"str": "str"}},
|
||||
api_version="2023-07-01-preview",
|
||||
).result() # call '.result()' to poll until service return final result
|
||||
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy
|
||||
def test_begin_delete(self, resource_group):
|
||||
response = self.client.dns_resolver_domain_lists.begin_delete(
|
||||
resource_group_name=resource_group.name,
|
||||
dns_resolver_domain_list_name="str",
|
||||
api_version="2023-07-01-preview",
|
||||
).result() # call '.result()' to poll until service return final result
|
||||
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy
|
||||
def test_get(self, resource_group):
|
||||
response = self.client.dns_resolver_domain_lists.get(
|
||||
resource_group_name=resource_group.name,
|
||||
dns_resolver_domain_list_name="str",
|
||||
api_version="2023-07-01-preview",
|
||||
)
|
||||
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy
|
||||
def test_list_by_resource_group(self, resource_group):
|
||||
response = self.client.dns_resolver_domain_lists.list_by_resource_group(
|
||||
resource_group_name=resource_group.name,
|
||||
api_version="2023-07-01-preview",
|
||||
)
|
||||
result = [r for r in response]
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy
|
||||
def test_list(self, resource_group):
|
||||
response = self.client.dns_resolver_domain_lists.list(
|
||||
api_version="2023-07-01-preview",
|
||||
)
|
||||
result = [r for r in response]
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
|
@ -0,0 +1,115 @@
|
|||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
import pytest
|
||||
from azure.mgmt.dnsresolver.aio import DnsResolverManagementClient
|
||||
|
||||
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
|
||||
from devtools_testutils.aio import recorded_by_proxy_async
|
||||
|
||||
AZURE_LOCATION = "eastus"
|
||||
|
||||
|
||||
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
|
||||
class TestDnsResolverManagementDnsResolverDomainListsOperationsAsync(AzureMgmtRecordedTestCase):
|
||||
def setup_method(self, method):
|
||||
self.client = self.create_mgmt_client(DnsResolverManagementClient, is_async=True)
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy_async
|
||||
async def test_begin_create_or_update(self, resource_group):
|
||||
response = await (
|
||||
await self.client.dns_resolver_domain_lists.begin_create_or_update(
|
||||
resource_group_name=resource_group.name,
|
||||
dns_resolver_domain_list_name="str",
|
||||
parameters={
|
||||
"domains": ["str"],
|
||||
"location": "str",
|
||||
"etag": "str",
|
||||
"id": "str",
|
||||
"name": "str",
|
||||
"provisioningState": "str",
|
||||
"resourceGuid": "str",
|
||||
"systemData": {
|
||||
"createdAt": "2020-02-20 00:00:00",
|
||||
"createdBy": "str",
|
||||
"createdByType": "str",
|
||||
"lastModifiedAt": "2020-02-20 00:00:00",
|
||||
"lastModifiedBy": "str",
|
||||
"lastModifiedByType": "str",
|
||||
},
|
||||
"tags": {"str": "str"},
|
||||
"type": "str",
|
||||
},
|
||||
api_version="2023-07-01-preview",
|
||||
)
|
||||
).result() # call '.result()' to poll until service return final result
|
||||
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy_async
|
||||
async def test_begin_update(self, resource_group):
|
||||
response = await (
|
||||
await self.client.dns_resolver_domain_lists.begin_update(
|
||||
resource_group_name=resource_group.name,
|
||||
dns_resolver_domain_list_name="str",
|
||||
parameters={"domains": ["str"], "tags": {"str": "str"}},
|
||||
api_version="2023-07-01-preview",
|
||||
)
|
||||
).result() # call '.result()' to poll until service return final result
|
||||
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy_async
|
||||
async def test_begin_delete(self, resource_group):
|
||||
response = await (
|
||||
await self.client.dns_resolver_domain_lists.begin_delete(
|
||||
resource_group_name=resource_group.name,
|
||||
dns_resolver_domain_list_name="str",
|
||||
api_version="2023-07-01-preview",
|
||||
)
|
||||
).result() # call '.result()' to poll until service return final result
|
||||
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy_async
|
||||
async def test_get(self, resource_group):
|
||||
response = await self.client.dns_resolver_domain_lists.get(
|
||||
resource_group_name=resource_group.name,
|
||||
dns_resolver_domain_list_name="str",
|
||||
api_version="2023-07-01-preview",
|
||||
)
|
||||
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy_async
|
||||
async def test_list_by_resource_group(self, resource_group):
|
||||
response = self.client.dns_resolver_domain_lists.list_by_resource_group(
|
||||
resource_group_name=resource_group.name,
|
||||
api_version="2023-07-01-preview",
|
||||
)
|
||||
result = [r async for r in response]
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
||||
|
||||
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
|
||||
@recorded_by_proxy_async
|
||||
async def test_list(self, resource_group):
|
||||
response = self.client.dns_resolver_domain_lists.list(
|
||||
api_version="2023-07-01-preview",
|
||||
)
|
||||
result = [r async for r in response]
|
||||
# please add some check logic here by yourself
|
||||
# ...
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче