diff --git a/sdk/network/azure-mgmt-privatedns/CHANGELOG.md b/sdk/network/azure-mgmt-privatedns/CHANGELOG.md index 97c3ac22f735..37aa183eeb48 100644 --- a/sdk/network/azure-mgmt-privatedns/CHANGELOG.md +++ b/sdk/network/azure-mgmt-privatedns/CHANGELOG.md @@ -1,5 +1,37 @@ # Release History +## 1.0.0b1 (2021-02-09) + +This is beta preview version. +For detailed changelog please refer to equivalent stable version 10.2.0 (https://pypi.org/project/azure-mgmt-network/10.2.0/) + +This version uses a next-generation code generator that introduces important breaking changes, but also important new features (like unified authentication and async programming). + +**General breaking changes** + +- Credential system has been completly revamped: + + - `azure.common.credentials` or `msrestazure.azure_active_directory` instances are no longer supported, use the `azure-identity` classes instead: https://pypi.org/project/azure-identity/ + - `credentials` parameter has been renamed `credential` + +- The `config` attribute no longer exists on a client, configuration should be passed as kwarg. Example: `MyClient(credential, subscription_id, enable_logging=True)`. For a complete set of + supported options, see the [parameters accept in init documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) +- You can't import a `version` module anymore, use `__version__` instead +- Operations that used to return a `msrest.polling.LROPoller` now returns a `azure.core.polling.LROPoller` and are prefixed with `begin_`. +- Exceptions tree have been simplified and most exceptions are now `azure.core.exceptions.HttpResponseError` (`CloudError` has been removed). +- Most of the operation kwarg have changed. Some of the most noticeable: + + - `raw` has been removed. Equivalent feature can be found using `cls`, a callback that will give access to internal HTTP response for advanced user + - For a complete set of + supported options, see the [parameters accept in Request documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) + +**General new features** + +- Type annotations support using `typing`. SDKs are mypy ready. +- This client has now stable and official support for async. Check the `aio` namespace of your package to find the async client. +- This client now support natively tracing library like OpenCensus or OpenTelemetry. See this [tracing quickstart](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/core/azure-core-tracing-opentelemetry) for an overview. + + ## 0.1.0 (2019-02-26) - Initial Release diff --git a/sdk/network/azure-mgmt-privatedns/README.md b/sdk/network/azure-mgmt-privatedns/README.md index 662c206fdd21..2871221be032 100644 --- a/sdk/network/azure-mgmt-privatedns/README.md +++ b/sdk/network/azure-mgmt-privatedns/README.md @@ -14,12 +14,16 @@ library. For a more complete set of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). -## Usage +# Usage -For code examples, see [DNS Private -Zones](https://docs.microsoft.com/python/api/overview/azure/) on -docs.microsoft.com. +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [Privatedns Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) ## Provide Feedback If you encounter any bugs or have suggestions, please file an issue in diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/__init__.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/__init__.py index d0aa64885b3f..1b5488f2e897 100644 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/__init__.py +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/__init__.py @@ -1,18 +1,19 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from .private_dns_management_client import PrivateDnsManagementClient -from .version import VERSION - -__all__ = ['PrivateDnsManagementClient'] +from ._private_dns_management_client import PrivateDnsManagementClient +from ._version import VERSION __version__ = VERSION +__all__ = ['PrivateDnsManagementClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/_configuration.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/_configuration.py new file mode 100644 index 000000000000..9506d6c322bb --- /dev/null +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/_configuration.py @@ -0,0 +1,71 @@ +# 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 typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class PrivateDnsManagementClientConfiguration(Configuration): + """Configuration for PrivateDnsManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(PrivateDnsManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2018-09-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-privatedns/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + 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.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/_metadata.json b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/_metadata.json new file mode 100644 index 000000000000..27b0f997b25b --- /dev/null +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/_metadata.json @@ -0,0 +1,63 @@ +{ + "chosen_version": "2018-09-01", + "total_api_version_list": ["2018-09-01"], + "client": { + "name": "PrivateDnsManagementClient", + "filename": "_private_dns_management_client", + "description": "The Private DNS Management Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": true + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null + }, + "operation_groups": { + "private_zones": "PrivateZonesOperations", + "virtual_network_links": "VirtualNetworkLinksOperations", + "record_sets": "RecordSetsOperations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/_private_dns_management_client.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/_private_dns_management_client.py new file mode 100644 index 000000000000..07e3e8d67a09 --- /dev/null +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/_private_dns_management_client.py @@ -0,0 +1,79 @@ +# 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 typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + +from ._configuration import PrivateDnsManagementClientConfiguration +from .operations import PrivateZonesOperations +from .operations import VirtualNetworkLinksOperations +from .operations import RecordSetsOperations +from . import models + + +class PrivateDnsManagementClient(object): + """The Private DNS Management Client. + + :ivar private_zones: PrivateZonesOperations operations + :vartype private_zones: azure.mgmt.privatedns.operations.PrivateZonesOperations + :ivar virtual_network_links: VirtualNetworkLinksOperations operations + :vartype virtual_network_links: azure.mgmt.privatedns.operations.VirtualNetworkLinksOperations + :ivar record_sets: RecordSetsOperations operations + :vartype record_sets: azure.mgmt.privatedns.operations.RecordSetsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = PrivateDnsManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.private_zones = PrivateZonesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_network_links = VirtualNetworkLinksOperations( + self._client, self._config, self._serialize, self._deserialize) + self.record_sets = RecordSetsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> PrivateDnsManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/version.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/_version.py similarity index 84% rename from sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/version.py rename to sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/_version.py index e0ec669828cb..e5754a47ce68 100644 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/version.py +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/_version.py @@ -1,13 +1,9 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "0.1.0" - +VERSION = "1.0.0b1" diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/__init__.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/__init__.py new file mode 100644 index 000000000000..0cc1426282f3 --- /dev/null +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._private_dns_management_client import PrivateDnsManagementClient +__all__ = ['PrivateDnsManagementClient'] diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/_configuration.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/_configuration.py new file mode 100644 index 000000000000..43d2ee16dd9d --- /dev/null +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/_configuration.py @@ -0,0 +1,67 @@ +# 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 typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class PrivateDnsManagementClientConfiguration(Configuration): + """Configuration for PrivateDnsManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(PrivateDnsManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2018-09-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-privatedns/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + 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.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/_private_dns_management_client.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/_private_dns_management_client.py new file mode 100644 index 000000000000..9409d44cc219 --- /dev/null +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/_private_dns_management_client.py @@ -0,0 +1,73 @@ +# 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 typing import Any, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import PrivateDnsManagementClientConfiguration +from .operations import PrivateZonesOperations +from .operations import VirtualNetworkLinksOperations +from .operations import RecordSetsOperations +from .. import models + + +class PrivateDnsManagementClient(object): + """The Private DNS Management Client. + + :ivar private_zones: PrivateZonesOperations operations + :vartype private_zones: azure.mgmt.privatedns.aio.operations.PrivateZonesOperations + :ivar virtual_network_links: VirtualNetworkLinksOperations operations + :vartype virtual_network_links: azure.mgmt.privatedns.aio.operations.VirtualNetworkLinksOperations + :ivar record_sets: RecordSetsOperations operations + :vartype record_sets: azure.mgmt.privatedns.aio.operations.RecordSetsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = PrivateDnsManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.private_zones = PrivateZonesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_network_links = VirtualNetworkLinksOperations( + self._client, self._config, self._serialize, self._deserialize) + self.record_sets = RecordSetsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "PrivateDnsManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/operations/__init__.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/operations/__init__.py new file mode 100644 index 000000000000..896182778bdb --- /dev/null +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/operations/__init__.py @@ -0,0 +1,17 @@ +# 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 ._private_zones_operations import PrivateZonesOperations +from ._virtual_network_links_operations import VirtualNetworkLinksOperations +from ._record_sets_operations import RecordSetsOperations + +__all__ = [ + 'PrivateZonesOperations', + 'VirtualNetworkLinksOperations', + 'RecordSetsOperations', +] diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/operations/_private_zones_operations.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/operations/_private_zones_operations.py new file mode 100644 index 000000000000..1fc8f581780e --- /dev/null +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/operations/_private_zones_operations.py @@ -0,0 +1,652 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateZonesOperations: + """PrivateZonesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.privatedns.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + private_zone_name: str, + parameters: "_models.PrivateZone", + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs + ) -> Optional["_models.PrivateZone"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateZone"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + if if_none_match is not None: + header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PrivateZone') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + 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('PrivateZone', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateZone', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + private_zone_name: str, + parameters: "_models.PrivateZone", + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs + ) -> AsyncLROPoller["_models.PrivateZone"]: + """Creates or updates a Private DNS zone. Does not modify Links to virtual networks or DNS records + within the zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param parameters: Parameters supplied to the CreateOrUpdate operation. + :type parameters: ~azure.mgmt.privatedns.models.PrivateZone + :param if_match: The ETag of the Private DNS zone. Omit this value to always overwrite the + current zone. Specify the last-seen ETag value to prevent accidentally overwriting any + concurrent changes. + :type if_match: str + :param if_none_match: Set to '*' to allow a new Private DNS zone to be created, but to prevent + updating an existing zone. Other values will be ignored. + :type if_none_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: True for ARMPolling, False for no polling, or a + polling object for 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 PrivateZone or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.privatedns.models.PrivateZone] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateZone"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + private_zone_name=private_zone_name, + parameters=parameters, + if_match=if_match, + if_none_match=if_none_match, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateZone', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + private_zone_name: str, + parameters: "_models.PrivateZone", + if_match: Optional[str] = None, + **kwargs + ) -> Optional["_models.PrivateZone"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateZone"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PrivateZone') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + 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('PrivateZone', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + private_zone_name: str, + parameters: "_models.PrivateZone", + if_match: Optional[str] = None, + **kwargs + ) -> AsyncLROPoller["_models.PrivateZone"]: + """Updates a Private DNS zone. Does not modify virtual network links or DNS records within the + zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param parameters: Parameters supplied to the Update operation. + :type parameters: ~azure.mgmt.privatedns.models.PrivateZone + :param if_match: The ETag of the Private DNS zone. Omit this value to always overwrite the + current zone. Specify the last-seen ETag value to prevent accidentally overwriting any + concurrent changes. + :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: True for ARMPolling, False for no polling, or a + polling object for 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 PrivateZone or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.privatedns.models.PrivateZone] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateZone"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + private_zone_name=private_zone_name, + parameters=parameters, + if_match=if_match, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateZone', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + private_zone_name: str, + if_match: Optional[str] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + 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, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + private_zone_name: str, + if_match: Optional[str] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a Private DNS zone. WARNING: All DNS records in the zone will also be deleted. This + operation cannot be undone. Private DNS zone cannot be deleted unless all virtual network links + to it are removed. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param if_match: The ETag of the Private DNS zone. Omit this value to always delete the current + zone. Specify the last-seen ETag value to prevent accidentally deleting any concurrent changes. + :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: True for ARMPolling, False for no polling, or a + polling object for 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + private_zone_name=private_zone_name, + if_match=if_match, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + private_zone_name: str, + **kwargs + ) -> "_models.PrivateZone": + """Gets a Private DNS zone. Retrieves the zone properties, but not the virtual networks links or + the record sets within the zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateZone, or the result of cls(response) + :rtype: ~azure.mgmt.privatedns.models.PrivateZone + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateZone"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateZone', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}'} # type: ignore + + def list( + self, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.PrivateZoneListResult"]: + """Lists the Private DNS zones in all resource groups in a subscription. + + :param top: The maximum number of Private DNS zones to return. If not specified, returns up to + 100 zones. + :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 PrivateZoneListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.privatedns.models.PrivateZoneListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateZoneListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateZoneListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/privateDnsZones'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.PrivateZoneListResult"]: + """Lists the Private DNS zones within a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param top: The maximum number of record sets to return. If not specified, returns up to 100 + record sets. + :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 PrivateZoneListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.privatedns.models.PrivateZoneListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateZoneListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateZoneListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones'} # type: ignore diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/operations/_record_sets_operations.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/operations/_record_sets_operations.py new file mode 100644 index 000000000000..8047b0e5a567 --- /dev/null +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/operations/_record_sets_operations.py @@ -0,0 +1,530 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RecordSetsOperations: + """RecordSetsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.privatedns.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create_or_update( + self, + resource_group_name: str, + private_zone_name: str, + record_type: Union[str, "_models.RecordType"], + relative_record_set_name: str, + parameters: "_models.RecordSet", + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs + ) -> "_models.RecordSet": + """Creates or updates a record set within a Private DNS zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param record_type: The type of DNS record in this record set. Record sets of type SOA can be + updated but not created (they are created when the Private DNS zone is created). + :type record_type: str or ~azure.mgmt.privatedns.models.RecordType + :param relative_record_set_name: The name of the record set, relative to the name of the zone. + :type relative_record_set_name: str + :param parameters: Parameters supplied to the CreateOrUpdate operation. + :type parameters: ~azure.mgmt.privatedns.models.RecordSet + :param if_match: The ETag of the record set. Omit this value to always overwrite the current + record set. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent + changes. + :type if_match: str + :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will be ignored. + :type if_none_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecordSet, or the result of cls(response) + :rtype: ~azure.mgmt.privatedns.models.RecordSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecordSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'recordType': self._serialize.url("record_type", record_type, 'str'), + 'relativeRecordSetName': self._serialize.url("relative_record_set_name", relative_record_set_name, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + if if_none_match is not None: + header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RecordSet') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + 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('RecordSet', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('RecordSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + private_zone_name: str, + record_type: Union[str, "_models.RecordType"], + relative_record_set_name: str, + parameters: "_models.RecordSet", + if_match: Optional[str] = None, + **kwargs + ) -> "_models.RecordSet": + """Updates a record set within a Private DNS zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param record_type: The type of DNS record in this record set. + :type record_type: str or ~azure.mgmt.privatedns.models.RecordType + :param relative_record_set_name: The name of the record set, relative to the name of the zone. + :type relative_record_set_name: str + :param parameters: Parameters supplied to the Update operation. + :type parameters: ~azure.mgmt.privatedns.models.RecordSet + :param if_match: The ETag of the record set. Omit this value to always overwrite the current + record set. Specify the last-seen ETag value to prevent accidentally overwriting concurrent + changes. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecordSet, or the result of cls(response) + :rtype: ~azure.mgmt.privatedns.models.RecordSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecordSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'recordType': self._serialize.url("record_type", record_type, 'str'), + 'relativeRecordSetName': self._serialize.url("relative_record_set_name", relative_record_set_name, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RecordSet') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RecordSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + private_zone_name: str, + record_type: Union[str, "_models.RecordType"], + relative_record_set_name: str, + if_match: Optional[str] = None, + **kwargs + ) -> None: + """Deletes a record set from a Private DNS zone. This operation cannot be undone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param record_type: The type of DNS record in this record set. Record sets of type SOA cannot + be deleted (they are deleted when the Private DNS zone is deleted). + :type record_type: str or ~azure.mgmt.privatedns.models.RecordType + :param relative_record_set_name: The name of the record set, relative to the name of the zone. + :type relative_record_set_name: str + :param if_match: The ETag of the record set. Omit this value to always delete the current + record set. Specify the last-seen ETag value to prevent accidentally deleting any concurrent + changes. + :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 + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'recordType': self._serialize.url("record_type", record_type, 'str'), + 'relativeRecordSetName': self._serialize.url("relative_record_set_name", relative_record_set_name, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + private_zone_name: str, + record_type: Union[str, "_models.RecordType"], + relative_record_set_name: str, + **kwargs + ) -> "_models.RecordSet": + """Gets a record set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param record_type: The type of DNS record in this record set. + :type record_type: str or ~azure.mgmt.privatedns.models.RecordType + :param relative_record_set_name: The name of the record set, relative to the name of the zone. + :type relative_record_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecordSet, or the result of cls(response) + :rtype: ~azure.mgmt.privatedns.models.RecordSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecordSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'recordType': self._serialize.url("record_type", record_type, 'str'), + 'relativeRecordSetName': self._serialize.url("relative_record_set_name", relative_record_set_name, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RecordSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}'} # type: ignore + + def list_by_type( + self, + resource_group_name: str, + private_zone_name: str, + record_type: Union[str, "_models.RecordType"], + top: Optional[int] = None, + recordsetnamesuffix: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.RecordSetListResult"]: + """Lists the record sets of a specified type in a Private DNS zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param record_type: The type of record sets to enumerate. + :type record_type: str or ~azure.mgmt.privatedns.models.RecordType + :param top: The maximum number of record sets to return. If not specified, returns up to 100 + record sets. + :type top: int + :param recordsetnamesuffix: The suffix label of the record set name to be used to filter the + record set enumeration. If this parameter is specified, the returned enumeration will only + contain records that end with ".:code:``". + :type recordsetnamesuffix: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecordSetListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.privatedns.models.RecordSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecordSetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_type.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'recordType': self._serialize.url("record_type", record_type, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if recordsetnamesuffix is not None: + query_parameters['$recordsetnamesuffix'] = self._serialize.query("recordsetnamesuffix", recordsetnamesuffix, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RecordSetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_type.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}'} # type: ignore + + def list( + self, + resource_group_name: str, + private_zone_name: str, + top: Optional[int] = None, + recordsetnamesuffix: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.RecordSetListResult"]: + """Lists all record sets in a Private DNS zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param top: The maximum number of record sets to return. If not specified, returns up to 100 + record sets. + :type top: int + :param recordsetnamesuffix: The suffix label of the record set name to be used to filter the + record set enumeration. If this parameter is specified, the returned enumeration will only + contain records that end with ".:code:``". + :type recordsetnamesuffix: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecordSetListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.privatedns.models.RecordSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecordSetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if recordsetnamesuffix is not None: + query_parameters['$recordsetnamesuffix'] = self._serialize.query("recordsetnamesuffix", recordsetnamesuffix, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RecordSetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/ALL'} # type: ignore diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/operations/_virtual_network_links_operations.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/operations/_virtual_network_links_operations.py new file mode 100644 index 000000000000..4c4a38900f75 --- /dev/null +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/aio/operations/_virtual_network_links_operations.py @@ -0,0 +1,607 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VirtualNetworkLinksOperations: + """VirtualNetworkLinksOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.privatedns.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + private_zone_name: str, + virtual_network_link_name: str, + parameters: "_models.VirtualNetworkLink", + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs + ) -> Optional["_models.VirtualNetworkLink"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VirtualNetworkLink"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'virtualNetworkLinkName': self._serialize.url("virtual_network_link_name", virtual_network_link_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + if if_none_match is not None: + header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VirtualNetworkLink') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + private_zone_name: str, + virtual_network_link_name: str, + parameters: "_models.VirtualNetworkLink", + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs + ) -> AsyncLROPoller["_models.VirtualNetworkLink"]: + """Creates or updates a virtual network link to the specified Private DNS zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param virtual_network_link_name: The name of the virtual network link. + :type virtual_network_link_name: str + :param parameters: Parameters supplied to the CreateOrUpdate operation. + :type parameters: ~azure.mgmt.privatedns.models.VirtualNetworkLink + :param if_match: The ETag of the virtual network link to the Private DNS zone. Omit this value + to always overwrite the current virtual network link. Specify the last-seen ETag value to + prevent accidentally overwriting any concurrent changes. + :type if_match: str + :param if_none_match: Set to '*' to allow a new virtual network link to the Private DNS zone to + be created, but to prevent updating an existing link. Other values will be ignored. + :type if_none_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: True for ARMPolling, False for no polling, or a + polling object for 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.privatedns.models.VirtualNetworkLink] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkLink"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + private_zone_name=private_zone_name, + virtual_network_link_name=virtual_network_link_name, + parameters=parameters, + if_match=if_match, + if_none_match=if_none_match, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualNetworkLink', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'virtualNetworkLinkName': self._serialize.url("virtual_network_link_name", virtual_network_link_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + private_zone_name: str, + virtual_network_link_name: str, + parameters: "_models.VirtualNetworkLink", + if_match: Optional[str] = None, + **kwargs + ) -> Optional["_models.VirtualNetworkLink"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VirtualNetworkLink"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'virtualNetworkLinkName': self._serialize.url("virtual_network_link_name", virtual_network_link_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VirtualNetworkLink') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + 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 cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + private_zone_name: str, + virtual_network_link_name: str, + parameters: "_models.VirtualNetworkLink", + if_match: Optional[str] = None, + **kwargs + ) -> AsyncLROPoller["_models.VirtualNetworkLink"]: + """Updates a virtual network link to the specified Private DNS zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param virtual_network_link_name: The name of the virtual network link. + :type virtual_network_link_name: str + :param parameters: Parameters supplied to the Update operation. + :type parameters: ~azure.mgmt.privatedns.models.VirtualNetworkLink + :param if_match: The ETag of the virtual network link to the Private DNS zone. Omit this value + to always overwrite the current virtual network link. Specify the last-seen ETag value to + prevent accidentally overwriting any concurrent changes. + :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: True for ARMPolling, False for no polling, or a + polling object for 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.privatedns.models.VirtualNetworkLink] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkLink"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + private_zone_name=private_zone_name, + virtual_network_link_name=virtual_network_link_name, + parameters=parameters, + if_match=if_match, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualNetworkLink', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'virtualNetworkLinkName': self._serialize.url("virtual_network_link_name", virtual_network_link_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + private_zone_name: str, + virtual_network_link_name: str, + if_match: Optional[str] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'virtualNetworkLinkName': self._serialize.url("virtual_network_link_name", virtual_network_link_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + 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, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + private_zone_name: str, + virtual_network_link_name: str, + if_match: Optional[str] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a virtual network link to the specified Private DNS zone. WARNING: In case of a + registration virtual network, all auto-registered DNS records in the zone for the virtual + network will also be deleted. This operation cannot be undone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param virtual_network_link_name: The name of the virtual network link. + :type virtual_network_link_name: str + :param if_match: The ETag of the virtual network link to the Private DNS zone. Omit this value + to always delete the current zone. Specify the last-seen ETag value to prevent accidentally + deleting any concurrent changes. + :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: True for ARMPolling, False for no polling, or a + polling object for 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + private_zone_name=private_zone_name, + virtual_network_link_name=virtual_network_link_name, + if_match=if_match, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'virtualNetworkLinkName': self._serialize.url("virtual_network_link_name", virtual_network_link_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + private_zone_name: str, + virtual_network_link_name: str, + **kwargs + ) -> "_models.VirtualNetworkLink": + """Gets a virtual network link to the specified Private DNS zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param virtual_network_link_name: The name of the virtual network link. + :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.privatedns.models.VirtualNetworkLink + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkLink"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'virtualNetworkLinkName': self._serialize.url("virtual_network_link_name", virtual_network_link_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualNetworkLink', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + + def list( + self, + resource_group_name: str, + private_zone_name: str, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.VirtualNetworkLinkListResult"]: + """Lists the virtual network links to the specified Private DNS zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param top: The maximum number of virtual network links to return. If not specified, returns up + to 100 virtual network links. + :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 VirtualNetworkLinkListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.privatedns.models.VirtualNetworkLinkListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkLinkListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualNetworkLinkListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks'} # type: ignore diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/__init__.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/__init__.py index b4b8674ba773..39a1bba99902 100644 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/__init__.py +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/__init__.py @@ -1,75 +1,79 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: - from .private_zone_py3 import PrivateZone - from .sub_resource_py3 import SubResource - from .virtual_network_link_py3 import VirtualNetworkLink - from .arecord_py3 import ARecord - from .aaaa_record_py3 import AaaaRecord - from .cname_record_py3 import CnameRecord - from .mx_record_py3 import MxRecord - from .ptr_record_py3 import PtrRecord - from .soa_record_py3 import SoaRecord - from .srv_record_py3 import SrvRecord - from .txt_record_py3 import TxtRecord - from .record_set_py3 import RecordSet - from .resource_py3 import Resource - from .tracked_resource_py3 import TrackedResource - from .proxy_resource_py3 import ProxyResource + from ._models_py3 import ARecord + from ._models_py3 import AaaaRecord + from ._models_py3 import CloudErrorBody + from ._models_py3 import CnameRecord + from ._models_py3 import MxRecord + from ._models_py3 import PrivateZone + from ._models_py3 import PrivateZoneListResult + from ._models_py3 import ProxyResource + from ._models_py3 import PtrRecord + from ._models_py3 import RecordSet + from ._models_py3 import RecordSetListResult + from ._models_py3 import Resource + from ._models_py3 import SoaRecord + from ._models_py3 import SrvRecord + from ._models_py3 import SubResource + from ._models_py3 import TrackedResource + from ._models_py3 import TxtRecord + from ._models_py3 import VirtualNetworkLink + from ._models_py3 import VirtualNetworkLinkListResult except (SyntaxError, ImportError): - from .private_zone import PrivateZone - from .sub_resource import SubResource - from .virtual_network_link import VirtualNetworkLink - from .arecord import ARecord - from .aaaa_record import AaaaRecord - from .cname_record import CnameRecord - from .mx_record import MxRecord - from .ptr_record import PtrRecord - from .soa_record import SoaRecord - from .srv_record import SrvRecord - from .txt_record import TxtRecord - from .record_set import RecordSet - from .resource import Resource - from .tracked_resource import TrackedResource - from .proxy_resource import ProxyResource -from .private_zone_paged import PrivateZonePaged -from .virtual_network_link_paged import VirtualNetworkLinkPaged -from .record_set_paged import RecordSetPaged -from .private_dns_management_client_enums import ( + from ._models import ARecord # type: ignore + from ._models import AaaaRecord # type: ignore + from ._models import CloudErrorBody # type: ignore + from ._models import CnameRecord # type: ignore + from ._models import MxRecord # type: ignore + from ._models import PrivateZone # type: ignore + from ._models import PrivateZoneListResult # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import PtrRecord # type: ignore + from ._models import RecordSet # type: ignore + from ._models import RecordSetListResult # type: ignore + from ._models import Resource # type: ignore + from ._models import SoaRecord # type: ignore + from ._models import SrvRecord # type: ignore + from ._models import SubResource # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import TxtRecord # type: ignore + from ._models import VirtualNetworkLink # type: ignore + from ._models import VirtualNetworkLinkListResult # type: ignore + +from ._private_dns_management_client_enums import ( ProvisioningState, - VirtualNetworkLinkState, RecordType, + VirtualNetworkLinkState, ) __all__ = [ - 'PrivateZone', - 'SubResource', - 'VirtualNetworkLink', 'ARecord', 'AaaaRecord', + 'CloudErrorBody', 'CnameRecord', 'MxRecord', + 'PrivateZone', + 'PrivateZoneListResult', + 'ProxyResource', 'PtrRecord', - 'SoaRecord', - 'SrvRecord', - 'TxtRecord', 'RecordSet', + 'RecordSetListResult', 'Resource', + 'SoaRecord', + 'SrvRecord', + 'SubResource', 'TrackedResource', - 'ProxyResource', - 'PrivateZonePaged', - 'VirtualNetworkLinkPaged', - 'RecordSetPaged', + 'TxtRecord', + 'VirtualNetworkLink', + 'VirtualNetworkLinkListResult', 'ProvisioningState', - 'VirtualNetworkLinkState', 'RecordType', + 'VirtualNetworkLinkState', ] diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/_models.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/_models.py new file mode 100644 index 000000000000..d9533cdd92e2 --- /dev/null +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/_models.py @@ -0,0 +1,698 @@ +# 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 msrest.serialization + + +class AaaaRecord(msrest.serialization.Model): + """An AAAA record. + + :param ipv6_address: The IPv6 address of this AAAA record. + :type ipv6_address: str + """ + + _attribute_map = { + 'ipv6_address': {'key': 'ipv6Address', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AaaaRecord, self).__init__(**kwargs) + self.ipv6_address = kwargs.get('ipv6_address', None) + + +class ARecord(msrest.serialization.Model): + """An A record. + + :param ipv4_address: The IPv4 address of this A record. + :type ipv4_address: str + """ + + _attribute_map = { + 'ipv4_address': {'key': 'ipv4Address', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ARecord, self).__init__(**kwargs) + self.ipv4_address = kwargs.get('ipv4_address', None) + + +class CloudErrorBody(msrest.serialization.Model): + """An error response from the service. + + :param code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :type code: str + :param message: A message describing the error, intended to be suitable for display in a user + interface. + :type message: str + :param target: The target of the particular error. For example, the name of the property in + error. + :type target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.privatedns.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudErrorBody, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) + + +class CnameRecord(msrest.serialization.Model): + """A CNAME record. + + :param cname: The canonical name for this CNAME record. + :type cname: str + """ + + _attribute_map = { + 'cname': {'key': 'cname', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CnameRecord, self).__init__(**kwargs) + self.cname = kwargs.get('cname', None) + + +class MxRecord(msrest.serialization.Model): + """An MX record. + + :param preference: The preference value for this MX record. + :type preference: int + :param exchange: The domain name of the mail host for this MX record. + :type exchange: str + """ + + _attribute_map = { + 'preference': {'key': 'preference', 'type': 'int'}, + 'exchange': {'key': 'exchange', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MxRecord, self).__init__(**kwargs) + self.preference = kwargs.get('preference', None) + self.exchange = kwargs.get('exchange', None) + + +class Resource(msrest.serialization.Model): + """The core properties of ARM resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Example - + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Example - + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: The Azure Region where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs.get('location', None) + + +class PrivateZone(TrackedResource): + """Describes a Private DNS zone. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Example - + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: The Azure Region where the resource lives. + :type location: str + :param etag: The ETag of the zone. + :type etag: str + :ivar max_number_of_record_sets: The maximum number of record sets that can be created in this + Private DNS zone. This is a read-only property and any attempt to set this value will be + ignored. + :vartype max_number_of_record_sets: long + :ivar number_of_record_sets: The current number of record sets in this Private DNS zone. This + is a read-only property and any attempt to set this value will be ignored. + :vartype number_of_record_sets: long + :ivar max_number_of_virtual_network_links: The maximum number of virtual networks that can be + linked to this Private DNS zone. This is a read-only property and any attempt to set this value + will be ignored. + :vartype max_number_of_virtual_network_links: long + :ivar number_of_virtual_network_links: The current number of virtual networks that are linked + to this Private DNS zone. This is a read-only property and any attempt to set this value will + be ignored. + :vartype number_of_virtual_network_links: long + :ivar max_number_of_virtual_network_links_with_registration: The maximum number of virtual + networks that can be linked to this Private DNS zone with registration enabled. This is a read- + only property and any attempt to set this value will be ignored. + :vartype max_number_of_virtual_network_links_with_registration: long + :ivar number_of_virtual_network_links_with_registration: The current number of virtual networks + that are linked to this Private DNS zone with registration enabled. This is a read-only + property and any attempt to set this value will be ignored. + :vartype number_of_virtual_network_links_with_registration: long + :ivar provisioning_state: The provisioning state of the resource. This is a read-only property + and any attempt to set this value will be ignored. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.privatedns.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'max_number_of_record_sets': {'readonly': True}, + 'number_of_record_sets': {'readonly': True}, + 'max_number_of_virtual_network_links': {'readonly': True}, + 'number_of_virtual_network_links': {'readonly': True}, + 'max_number_of_virtual_network_links_with_registration': {'readonly': True}, + 'number_of_virtual_network_links_with_registration': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'max_number_of_record_sets': {'key': 'properties.maxNumberOfRecordSets', 'type': 'long'}, + 'number_of_record_sets': {'key': 'properties.numberOfRecordSets', 'type': 'long'}, + 'max_number_of_virtual_network_links': {'key': 'properties.maxNumberOfVirtualNetworkLinks', 'type': 'long'}, + 'number_of_virtual_network_links': {'key': 'properties.numberOfVirtualNetworkLinks', 'type': 'long'}, + 'max_number_of_virtual_network_links_with_registration': {'key': 'properties.maxNumberOfVirtualNetworkLinksWithRegistration', 'type': 'long'}, + 'number_of_virtual_network_links_with_registration': {'key': 'properties.numberOfVirtualNetworkLinksWithRegistration', 'type': 'long'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateZone, self).__init__(**kwargs) + self.etag = kwargs.get('etag', None) + self.max_number_of_record_sets = None + self.number_of_record_sets = None + self.max_number_of_virtual_network_links = None + self.number_of_virtual_network_links = None + self.max_number_of_virtual_network_links_with_registration = None + self.number_of_virtual_network_links_with_registration = None + self.provisioning_state = None + + +class PrivateZoneListResult(msrest.serialization.Model): + """The response to a Private DNS zone list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Information about the Private DNS zones. + :type value: list[~azure.mgmt.privatedns.models.PrivateZone] + :ivar next_link: The continuation token for the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateZone]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateZoneListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ProxyResource(Resource): + """The resource model definition for an ARM proxy resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Example - + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + + +class PtrRecord(msrest.serialization.Model): + """A PTR record. + + :param ptrdname: The PTR target domain name for this PTR record. + :type ptrdname: str + """ + + _attribute_map = { + 'ptrdname': {'key': 'ptrdname', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PtrRecord, self).__init__(**kwargs) + self.ptrdname = kwargs.get('ptrdname', None) + + +class RecordSet(Resource): + """Describes a DNS record set (a collection of DNS records with the same name and type) in a Private DNS zone. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Example - + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + :vartype type: str + :param etag: The ETag of the record set. + :type etag: str + :param metadata: The metadata attached to the record set. + :type metadata: dict[str, str] + :param ttl: The TTL (time-to-live) of the records in the record set. + :type ttl: long + :ivar fqdn: Fully qualified domain name of the record set. + :vartype fqdn: str + :ivar is_auto_registered: Is the record set auto-registered in the Private DNS zone through a + virtual network link?. + :vartype is_auto_registered: bool + :param a_records: The list of A records in the record set. + :type a_records: list[~azure.mgmt.privatedns.models.ARecord] + :param aaaa_records: The list of AAAA records in the record set. + :type aaaa_records: list[~azure.mgmt.privatedns.models.AaaaRecord] + :param cname_record: The CNAME record in the record set. + :type cname_record: ~azure.mgmt.privatedns.models.CnameRecord + :param mx_records: The list of MX records in the record set. + :type mx_records: list[~azure.mgmt.privatedns.models.MxRecord] + :param ptr_records: The list of PTR records in the record set. + :type ptr_records: list[~azure.mgmt.privatedns.models.PtrRecord] + :param soa_record: The SOA record in the record set. + :type soa_record: ~azure.mgmt.privatedns.models.SoaRecord + :param srv_records: The list of SRV records in the record set. + :type srv_records: list[~azure.mgmt.privatedns.models.SrvRecord] + :param txt_records: The list of TXT records in the record set. + :type txt_records: list[~azure.mgmt.privatedns.models.TxtRecord] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'fqdn': {'readonly': True}, + 'is_auto_registered': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, + 'ttl': {'key': 'properties.ttl', 'type': 'long'}, + 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, + 'is_auto_registered': {'key': 'properties.isAutoRegistered', 'type': 'bool'}, + 'a_records': {'key': 'properties.aRecords', 'type': '[ARecord]'}, + 'aaaa_records': {'key': 'properties.aaaaRecords', 'type': '[AaaaRecord]'}, + 'cname_record': {'key': 'properties.cnameRecord', 'type': 'CnameRecord'}, + 'mx_records': {'key': 'properties.mxRecords', 'type': '[MxRecord]'}, + 'ptr_records': {'key': 'properties.ptrRecords', 'type': '[PtrRecord]'}, + 'soa_record': {'key': 'properties.soaRecord', 'type': 'SoaRecord'}, + 'srv_records': {'key': 'properties.srvRecords', 'type': '[SrvRecord]'}, + 'txt_records': {'key': 'properties.txtRecords', 'type': '[TxtRecord]'}, + } + + def __init__( + self, + **kwargs + ): + super(RecordSet, self).__init__(**kwargs) + self.etag = kwargs.get('etag', None) + self.metadata = kwargs.get('metadata', None) + self.ttl = kwargs.get('ttl', None) + self.fqdn = None + self.is_auto_registered = None + self.a_records = kwargs.get('a_records', None) + self.aaaa_records = kwargs.get('aaaa_records', None) + self.cname_record = kwargs.get('cname_record', None) + self.mx_records = kwargs.get('mx_records', None) + self.ptr_records = kwargs.get('ptr_records', None) + self.soa_record = kwargs.get('soa_record', None) + self.srv_records = kwargs.get('srv_records', None) + self.txt_records = kwargs.get('txt_records', None) + + +class RecordSetListResult(msrest.serialization.Model): + """The response to a record set list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Information about the record sets in the response. + :type value: list[~azure.mgmt.privatedns.models.RecordSet] + :ivar next_link: The continuation token for the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RecordSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RecordSetListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class SoaRecord(msrest.serialization.Model): + """An SOA record. + + :param host: The domain name of the authoritative name server for this SOA record. + :type host: str + :param email: The email contact for this SOA record. + :type email: str + :param serial_number: The serial number for this SOA record. + :type serial_number: long + :param refresh_time: The refresh value for this SOA record. + :type refresh_time: long + :param retry_time: The retry time for this SOA record. + :type retry_time: long + :param expire_time: The expire time for this SOA record. + :type expire_time: long + :param minimum_ttl: The minimum value for this SOA record. By convention this is used to + determine the negative caching duration. + :type minimum_ttl: long + """ + + _attribute_map = { + 'host': {'key': 'host', 'type': 'str'}, + 'email': {'key': 'email', 'type': 'str'}, + 'serial_number': {'key': 'serialNumber', 'type': 'long'}, + 'refresh_time': {'key': 'refreshTime', 'type': 'long'}, + 'retry_time': {'key': 'retryTime', 'type': 'long'}, + 'expire_time': {'key': 'expireTime', 'type': 'long'}, + 'minimum_ttl': {'key': 'minimumTtl', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(SoaRecord, self).__init__(**kwargs) + self.host = kwargs.get('host', None) + self.email = kwargs.get('email', None) + self.serial_number = kwargs.get('serial_number', None) + self.refresh_time = kwargs.get('refresh_time', None) + self.retry_time = kwargs.get('retry_time', None) + self.expire_time = kwargs.get('expire_time', None) + self.minimum_ttl = kwargs.get('minimum_ttl', None) + + +class SrvRecord(msrest.serialization.Model): + """An SRV record. + + :param priority: The priority value for this SRV record. + :type priority: int + :param weight: The weight value for this SRV record. + :type weight: int + :param port: The port value for this SRV record. + :type port: int + :param target: The target domain name for this SRV record. + :type target: str + """ + + _attribute_map = { + 'priority': {'key': 'priority', 'type': 'int'}, + 'weight': {'key': 'weight', 'type': 'int'}, + 'port': {'key': 'port', 'type': 'int'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SrvRecord, self).__init__(**kwargs) + self.priority = kwargs.get('priority', None) + self.weight = kwargs.get('weight', None) + self.port = kwargs.get('port', None) + self.target = kwargs.get('target', None) + + +class SubResource(msrest.serialization.Model): + """Reference to another subresource. + + :param id: Resource ID. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SubResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class TxtRecord(msrest.serialization.Model): + """A TXT record. + + :param value: The text value of this TXT record. + :type value: list[str] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(TxtRecord, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class VirtualNetworkLink(TrackedResource): + """Describes a link to virtual network for a Private DNS zone. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Example - + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: The Azure Region where the resource lives. + :type location: str + :param etag: The ETag of the virtual network link. + :type etag: str + :param virtual_network: The reference of the virtual network. + :type virtual_network: ~azure.mgmt.privatedns.models.SubResource + :param registration_enabled: Is auto-registration of virtual machine records in the virtual + network in the Private DNS zone enabled?. + :type registration_enabled: bool + :ivar virtual_network_link_state: The status of the virtual network link to the Private DNS + zone. Possible values are 'InProgress' and 'Done'. This is a read-only property and any attempt + to set this value will be ignored. Possible values include: "InProgress", "Completed". + :vartype virtual_network_link_state: str or + ~azure.mgmt.privatedns.models.VirtualNetworkLinkState + :ivar provisioning_state: The provisioning state of the resource. This is a read-only property + and any attempt to set this value will be ignored. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.privatedns.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'virtual_network_link_state': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'virtual_network': {'key': 'properties.virtualNetwork', 'type': 'SubResource'}, + 'registration_enabled': {'key': 'properties.registrationEnabled', 'type': 'bool'}, + 'virtual_network_link_state': {'key': 'properties.virtualNetworkLinkState', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualNetworkLink, self).__init__(**kwargs) + self.etag = kwargs.get('etag', None) + self.virtual_network = kwargs.get('virtual_network', None) + self.registration_enabled = kwargs.get('registration_enabled', None) + self.virtual_network_link_state = None + self.provisioning_state = None + + +class VirtualNetworkLinkListResult(msrest.serialization.Model): + """The response to a list virtual network link to Private DNS zone operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Information about the virtual network links to the Private DNS zones. + :type value: list[~azure.mgmt.privatedns.models.VirtualNetworkLink] + :ivar next_link: The continuation token for the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualNetworkLink]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualNetworkLinkListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/_models_py3.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/_models_py3.py new file mode 100644 index 000000000000..989cc02fb294 --- /dev/null +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/_models_py3.py @@ -0,0 +1,764 @@ +# 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 typing import Dict, List, Optional + +import msrest.serialization + + +class AaaaRecord(msrest.serialization.Model): + """An AAAA record. + + :param ipv6_address: The IPv6 address of this AAAA record. + :type ipv6_address: str + """ + + _attribute_map = { + 'ipv6_address': {'key': 'ipv6Address', 'type': 'str'}, + } + + def __init__( + self, + *, + ipv6_address: Optional[str] = None, + **kwargs + ): + super(AaaaRecord, self).__init__(**kwargs) + self.ipv6_address = ipv6_address + + +class ARecord(msrest.serialization.Model): + """An A record. + + :param ipv4_address: The IPv4 address of this A record. + :type ipv4_address: str + """ + + _attribute_map = { + 'ipv4_address': {'key': 'ipv4Address', 'type': 'str'}, + } + + def __init__( + self, + *, + ipv4_address: Optional[str] = None, + **kwargs + ): + super(ARecord, self).__init__(**kwargs) + self.ipv4_address = ipv4_address + + +class CloudErrorBody(msrest.serialization.Model): + """An error response from the service. + + :param code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :type code: str + :param message: A message describing the error, intended to be suitable for display in a user + interface. + :type message: str + :param target: The target of the particular error. For example, the name of the property in + error. + :type target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.privatedns.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["CloudErrorBody"]] = None, + **kwargs + ): + super(CloudErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class CnameRecord(msrest.serialization.Model): + """A CNAME record. + + :param cname: The canonical name for this CNAME record. + :type cname: str + """ + + _attribute_map = { + 'cname': {'key': 'cname', 'type': 'str'}, + } + + def __init__( + self, + *, + cname: Optional[str] = None, + **kwargs + ): + super(CnameRecord, self).__init__(**kwargs) + self.cname = cname + + +class MxRecord(msrest.serialization.Model): + """An MX record. + + :param preference: The preference value for this MX record. + :type preference: int + :param exchange: The domain name of the mail host for this MX record. + :type exchange: str + """ + + _attribute_map = { + 'preference': {'key': 'preference', 'type': 'int'}, + 'exchange': {'key': 'exchange', 'type': 'str'}, + } + + def __init__( + self, + *, + preference: Optional[int] = None, + exchange: Optional[str] = None, + **kwargs + ): + super(MxRecord, self).__init__(**kwargs) + self.preference = preference + self.exchange = exchange + + +class Resource(msrest.serialization.Model): + """The core properties of ARM resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Example - + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Example - + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: The Azure Region where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + location: Optional[str] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class PrivateZone(TrackedResource): + """Describes a Private DNS zone. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Example - + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: The Azure Region where the resource lives. + :type location: str + :param etag: The ETag of the zone. + :type etag: str + :ivar max_number_of_record_sets: The maximum number of record sets that can be created in this + Private DNS zone. This is a read-only property and any attempt to set this value will be + ignored. + :vartype max_number_of_record_sets: long + :ivar number_of_record_sets: The current number of record sets in this Private DNS zone. This + is a read-only property and any attempt to set this value will be ignored. + :vartype number_of_record_sets: long + :ivar max_number_of_virtual_network_links: The maximum number of virtual networks that can be + linked to this Private DNS zone. This is a read-only property and any attempt to set this value + will be ignored. + :vartype max_number_of_virtual_network_links: long + :ivar number_of_virtual_network_links: The current number of virtual networks that are linked + to this Private DNS zone. This is a read-only property and any attempt to set this value will + be ignored. + :vartype number_of_virtual_network_links: long + :ivar max_number_of_virtual_network_links_with_registration: The maximum number of virtual + networks that can be linked to this Private DNS zone with registration enabled. This is a read- + only property and any attempt to set this value will be ignored. + :vartype max_number_of_virtual_network_links_with_registration: long + :ivar number_of_virtual_network_links_with_registration: The current number of virtual networks + that are linked to this Private DNS zone with registration enabled. This is a read-only + property and any attempt to set this value will be ignored. + :vartype number_of_virtual_network_links_with_registration: long + :ivar provisioning_state: The provisioning state of the resource. This is a read-only property + and any attempt to set this value will be ignored. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.privatedns.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'max_number_of_record_sets': {'readonly': True}, + 'number_of_record_sets': {'readonly': True}, + 'max_number_of_virtual_network_links': {'readonly': True}, + 'number_of_virtual_network_links': {'readonly': True}, + 'max_number_of_virtual_network_links_with_registration': {'readonly': True}, + 'number_of_virtual_network_links_with_registration': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'max_number_of_record_sets': {'key': 'properties.maxNumberOfRecordSets', 'type': 'long'}, + 'number_of_record_sets': {'key': 'properties.numberOfRecordSets', 'type': 'long'}, + 'max_number_of_virtual_network_links': {'key': 'properties.maxNumberOfVirtualNetworkLinks', 'type': 'long'}, + 'number_of_virtual_network_links': {'key': 'properties.numberOfVirtualNetworkLinks', 'type': 'long'}, + 'max_number_of_virtual_network_links_with_registration': {'key': 'properties.maxNumberOfVirtualNetworkLinksWithRegistration', 'type': 'long'}, + 'number_of_virtual_network_links_with_registration': {'key': 'properties.numberOfVirtualNetworkLinksWithRegistration', 'type': 'long'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + location: Optional[str] = None, + etag: Optional[str] = None, + **kwargs + ): + super(PrivateZone, self).__init__(tags=tags, location=location, **kwargs) + self.etag = etag + self.max_number_of_record_sets = None + self.number_of_record_sets = None + self.max_number_of_virtual_network_links = None + self.number_of_virtual_network_links = None + self.max_number_of_virtual_network_links_with_registration = None + self.number_of_virtual_network_links_with_registration = None + self.provisioning_state = None + + +class PrivateZoneListResult(msrest.serialization.Model): + """The response to a Private DNS zone list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Information about the Private DNS zones. + :type value: list[~azure.mgmt.privatedns.models.PrivateZone] + :ivar next_link: The continuation token for the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateZone]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateZone"]] = None, + **kwargs + ): + super(PrivateZoneListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ProxyResource(Resource): + """The resource model definition for an ARM proxy resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Example - + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + + +class PtrRecord(msrest.serialization.Model): + """A PTR record. + + :param ptrdname: The PTR target domain name for this PTR record. + :type ptrdname: str + """ + + _attribute_map = { + 'ptrdname': {'key': 'ptrdname', 'type': 'str'}, + } + + def __init__( + self, + *, + ptrdname: Optional[str] = None, + **kwargs + ): + super(PtrRecord, self).__init__(**kwargs) + self.ptrdname = ptrdname + + +class RecordSet(Resource): + """Describes a DNS record set (a collection of DNS records with the same name and type) in a Private DNS zone. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Example - + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + :vartype type: str + :param etag: The ETag of the record set. + :type etag: str + :param metadata: The metadata attached to the record set. + :type metadata: dict[str, str] + :param ttl: The TTL (time-to-live) of the records in the record set. + :type ttl: long + :ivar fqdn: Fully qualified domain name of the record set. + :vartype fqdn: str + :ivar is_auto_registered: Is the record set auto-registered in the Private DNS zone through a + virtual network link?. + :vartype is_auto_registered: bool + :param a_records: The list of A records in the record set. + :type a_records: list[~azure.mgmt.privatedns.models.ARecord] + :param aaaa_records: The list of AAAA records in the record set. + :type aaaa_records: list[~azure.mgmt.privatedns.models.AaaaRecord] + :param cname_record: The CNAME record in the record set. + :type cname_record: ~azure.mgmt.privatedns.models.CnameRecord + :param mx_records: The list of MX records in the record set. + :type mx_records: list[~azure.mgmt.privatedns.models.MxRecord] + :param ptr_records: The list of PTR records in the record set. + :type ptr_records: list[~azure.mgmt.privatedns.models.PtrRecord] + :param soa_record: The SOA record in the record set. + :type soa_record: ~azure.mgmt.privatedns.models.SoaRecord + :param srv_records: The list of SRV records in the record set. + :type srv_records: list[~azure.mgmt.privatedns.models.SrvRecord] + :param txt_records: The list of TXT records in the record set. + :type txt_records: list[~azure.mgmt.privatedns.models.TxtRecord] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'fqdn': {'readonly': True}, + 'is_auto_registered': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, + 'ttl': {'key': 'properties.ttl', 'type': 'long'}, + 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, + 'is_auto_registered': {'key': 'properties.isAutoRegistered', 'type': 'bool'}, + 'a_records': {'key': 'properties.aRecords', 'type': '[ARecord]'}, + 'aaaa_records': {'key': 'properties.aaaaRecords', 'type': '[AaaaRecord]'}, + 'cname_record': {'key': 'properties.cnameRecord', 'type': 'CnameRecord'}, + 'mx_records': {'key': 'properties.mxRecords', 'type': '[MxRecord]'}, + 'ptr_records': {'key': 'properties.ptrRecords', 'type': '[PtrRecord]'}, + 'soa_record': {'key': 'properties.soaRecord', 'type': 'SoaRecord'}, + 'srv_records': {'key': 'properties.srvRecords', 'type': '[SrvRecord]'}, + 'txt_records': {'key': 'properties.txtRecords', 'type': '[TxtRecord]'}, + } + + def __init__( + self, + *, + etag: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, + ttl: Optional[int] = None, + a_records: Optional[List["ARecord"]] = None, + aaaa_records: Optional[List["AaaaRecord"]] = None, + cname_record: Optional["CnameRecord"] = None, + mx_records: Optional[List["MxRecord"]] = None, + ptr_records: Optional[List["PtrRecord"]] = None, + soa_record: Optional["SoaRecord"] = None, + srv_records: Optional[List["SrvRecord"]] = None, + txt_records: Optional[List["TxtRecord"]] = None, + **kwargs + ): + super(RecordSet, self).__init__(**kwargs) + self.etag = etag + self.metadata = metadata + self.ttl = ttl + self.fqdn = None + self.is_auto_registered = None + self.a_records = a_records + self.aaaa_records = aaaa_records + self.cname_record = cname_record + self.mx_records = mx_records + self.ptr_records = ptr_records + self.soa_record = soa_record + self.srv_records = srv_records + self.txt_records = txt_records + + +class RecordSetListResult(msrest.serialization.Model): + """The response to a record set list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Information about the record sets in the response. + :type value: list[~azure.mgmt.privatedns.models.RecordSet] + :ivar next_link: The continuation token for the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RecordSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["RecordSet"]] = None, + **kwargs + ): + super(RecordSetListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class SoaRecord(msrest.serialization.Model): + """An SOA record. + + :param host: The domain name of the authoritative name server for this SOA record. + :type host: str + :param email: The email contact for this SOA record. + :type email: str + :param serial_number: The serial number for this SOA record. + :type serial_number: long + :param refresh_time: The refresh value for this SOA record. + :type refresh_time: long + :param retry_time: The retry time for this SOA record. + :type retry_time: long + :param expire_time: The expire time for this SOA record. + :type expire_time: long + :param minimum_ttl: The minimum value for this SOA record. By convention this is used to + determine the negative caching duration. + :type minimum_ttl: long + """ + + _attribute_map = { + 'host': {'key': 'host', 'type': 'str'}, + 'email': {'key': 'email', 'type': 'str'}, + 'serial_number': {'key': 'serialNumber', 'type': 'long'}, + 'refresh_time': {'key': 'refreshTime', 'type': 'long'}, + 'retry_time': {'key': 'retryTime', 'type': 'long'}, + 'expire_time': {'key': 'expireTime', 'type': 'long'}, + 'minimum_ttl': {'key': 'minimumTtl', 'type': 'long'}, + } + + def __init__( + self, + *, + host: Optional[str] = None, + email: Optional[str] = None, + serial_number: Optional[int] = None, + refresh_time: Optional[int] = None, + retry_time: Optional[int] = None, + expire_time: Optional[int] = None, + minimum_ttl: Optional[int] = None, + **kwargs + ): + super(SoaRecord, self).__init__(**kwargs) + self.host = host + self.email = email + self.serial_number = serial_number + self.refresh_time = refresh_time + self.retry_time = retry_time + self.expire_time = expire_time + self.minimum_ttl = minimum_ttl + + +class SrvRecord(msrest.serialization.Model): + """An SRV record. + + :param priority: The priority value for this SRV record. + :type priority: int + :param weight: The weight value for this SRV record. + :type weight: int + :param port: The port value for this SRV record. + :type port: int + :param target: The target domain name for this SRV record. + :type target: str + """ + + _attribute_map = { + 'priority': {'key': 'priority', 'type': 'int'}, + 'weight': {'key': 'weight', 'type': 'int'}, + 'port': {'key': 'port', 'type': 'int'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__( + self, + *, + priority: Optional[int] = None, + weight: Optional[int] = None, + port: Optional[int] = None, + target: Optional[str] = None, + **kwargs + ): + super(SrvRecord, self).__init__(**kwargs) + self.priority = priority + self.weight = weight + self.port = port + self.target = target + + +class SubResource(msrest.serialization.Model): + """Reference to another subresource. + + :param id: Resource ID. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(SubResource, self).__init__(**kwargs) + self.id = id + + +class TxtRecord(msrest.serialization.Model): + """A TXT record. + + :param value: The text value of this TXT record. + :type value: list[str] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[str]'}, + } + + def __init__( + self, + *, + value: Optional[List[str]] = None, + **kwargs + ): + super(TxtRecord, self).__init__(**kwargs) + self.value = value + + +class VirtualNetworkLink(TrackedResource): + """Describes a link to virtual network for a Private DNS zone. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Example - + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: The Azure Region where the resource lives. + :type location: str + :param etag: The ETag of the virtual network link. + :type etag: str + :param virtual_network: The reference of the virtual network. + :type virtual_network: ~azure.mgmt.privatedns.models.SubResource + :param registration_enabled: Is auto-registration of virtual machine records in the virtual + network in the Private DNS zone enabled?. + :type registration_enabled: bool + :ivar virtual_network_link_state: The status of the virtual network link to the Private DNS + zone. Possible values are 'InProgress' and 'Done'. This is a read-only property and any attempt + to set this value will be ignored. Possible values include: "InProgress", "Completed". + :vartype virtual_network_link_state: str or + ~azure.mgmt.privatedns.models.VirtualNetworkLinkState + :ivar provisioning_state: The provisioning state of the resource. This is a read-only property + and any attempt to set this value will be ignored. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.privatedns.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'virtual_network_link_state': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'virtual_network': {'key': 'properties.virtualNetwork', 'type': 'SubResource'}, + 'registration_enabled': {'key': 'properties.registrationEnabled', 'type': 'bool'}, + 'virtual_network_link_state': {'key': 'properties.virtualNetworkLinkState', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + location: Optional[str] = None, + etag: Optional[str] = None, + virtual_network: Optional["SubResource"] = None, + registration_enabled: Optional[bool] = None, + **kwargs + ): + super(VirtualNetworkLink, self).__init__(tags=tags, location=location, **kwargs) + self.etag = etag + self.virtual_network = virtual_network + self.registration_enabled = registration_enabled + self.virtual_network_link_state = None + self.provisioning_state = None + + +class VirtualNetworkLinkListResult(msrest.serialization.Model): + """The response to a list virtual network link to Private DNS zone operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Information about the virtual network links to the Private DNS zones. + :type value: list[~azure.mgmt.privatedns.models.VirtualNetworkLink] + :ivar next_link: The continuation token for the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualNetworkLink]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["VirtualNetworkLink"]] = None, + **kwargs + ): + super(VirtualNetworkLinkListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/_private_dns_management_client_enums.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/_private_dns_management_client_enums.py new file mode 100644 index 000000000000..8052357f4a4d --- /dev/null +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/_private_dns_management_client_enums.py @@ -0,0 +1,59 @@ +# 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 enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state of the resource. This is a read-only property and any attempt to set + this value will be ignored. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + +class RecordType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + A = "A" + AAAA = "AAAA" + CNAME = "CNAME" + MX = "MX" + PTR = "PTR" + SOA = "SOA" + SRV = "SRV" + TXT = "TXT" + +class VirtualNetworkLinkState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of the virtual network link to the Private DNS zone. Possible values are + 'InProgress' and 'Done'. This is a read-only property and any attempt to set this value will be + ignored. + """ + + IN_PROGRESS = "InProgress" + COMPLETED = "Completed" diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/aaaa_record.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/aaaa_record.py deleted file mode 100644 index 4f4b45183a80..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/aaaa_record.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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 msrest.serialization import Model - - -class AaaaRecord(Model): - """An AAAA record. - - :param ipv6_address: The IPv6 address of this AAAA record. - :type ipv6_address: str - """ - - _attribute_map = { - 'ipv6_address': {'key': 'ipv6Address', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(AaaaRecord, self).__init__(**kwargs) - self.ipv6_address = kwargs.get('ipv6_address', None) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/aaaa_record_py3.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/aaaa_record_py3.py deleted file mode 100644 index 2cd662761ff9..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/aaaa_record_py3.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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 msrest.serialization import Model - - -class AaaaRecord(Model): - """An AAAA record. - - :param ipv6_address: The IPv6 address of this AAAA record. - :type ipv6_address: str - """ - - _attribute_map = { - 'ipv6_address': {'key': 'ipv6Address', 'type': 'str'}, - } - - def __init__(self, *, ipv6_address: str=None, **kwargs) -> None: - super(AaaaRecord, self).__init__(**kwargs) - self.ipv6_address = ipv6_address diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/arecord.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/arecord.py deleted file mode 100644 index 7172ccbb9011..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/arecord.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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 msrest.serialization import Model - - -class ARecord(Model): - """An A record. - - :param ipv4_address: The IPv4 address of this A record. - :type ipv4_address: str - """ - - _attribute_map = { - 'ipv4_address': {'key': 'ipv4Address', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(ARecord, self).__init__(**kwargs) - self.ipv4_address = kwargs.get('ipv4_address', None) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/arecord_py3.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/arecord_py3.py deleted file mode 100644 index d38c7f033aae..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/arecord_py3.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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 msrest.serialization import Model - - -class ARecord(Model): - """An A record. - - :param ipv4_address: The IPv4 address of this A record. - :type ipv4_address: str - """ - - _attribute_map = { - 'ipv4_address': {'key': 'ipv4Address', 'type': 'str'}, - } - - def __init__(self, *, ipv4_address: str=None, **kwargs) -> None: - super(ARecord, self).__init__(**kwargs) - self.ipv4_address = ipv4_address diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/cname_record.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/cname_record.py deleted file mode 100644 index 3812539e3504..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/cname_record.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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 msrest.serialization import Model - - -class CnameRecord(Model): - """A CNAME record. - - :param cname: The canonical name for this CNAME record. - :type cname: str - """ - - _attribute_map = { - 'cname': {'key': 'cname', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(CnameRecord, self).__init__(**kwargs) - self.cname = kwargs.get('cname', None) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/cname_record_py3.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/cname_record_py3.py deleted file mode 100644 index 903f7071d615..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/cname_record_py3.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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 msrest.serialization import Model - - -class CnameRecord(Model): - """A CNAME record. - - :param cname: The canonical name for this CNAME record. - :type cname: str - """ - - _attribute_map = { - 'cname': {'key': 'cname', 'type': 'str'}, - } - - def __init__(self, *, cname: str=None, **kwargs) -> None: - super(CnameRecord, self).__init__(**kwargs) - self.cname = cname diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/mx_record.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/mx_record.py deleted file mode 100644 index 8027663c4de5..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/mx_record.py +++ /dev/null @@ -1,32 +0,0 @@ -# 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 msrest.serialization import Model - - -class MxRecord(Model): - """An MX record. - - :param preference: The preference value for this MX record. - :type preference: int - :param exchange: The domain name of the mail host for this MX record. - :type exchange: str - """ - - _attribute_map = { - 'preference': {'key': 'preference', 'type': 'int'}, - 'exchange': {'key': 'exchange', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(MxRecord, self).__init__(**kwargs) - self.preference = kwargs.get('preference', None) - self.exchange = kwargs.get('exchange', None) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/mx_record_py3.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/mx_record_py3.py deleted file mode 100644 index 6476cd65eb3a..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/mx_record_py3.py +++ /dev/null @@ -1,32 +0,0 @@ -# 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 msrest.serialization import Model - - -class MxRecord(Model): - """An MX record. - - :param preference: The preference value for this MX record. - :type preference: int - :param exchange: The domain name of the mail host for this MX record. - :type exchange: str - """ - - _attribute_map = { - 'preference': {'key': 'preference', 'type': 'int'}, - 'exchange': {'key': 'exchange', 'type': 'str'}, - } - - def __init__(self, *, preference: int=None, exchange: str=None, **kwargs) -> None: - super(MxRecord, self).__init__(**kwargs) - self.preference = preference - self.exchange = exchange diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/private_dns_management_client_enums.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/private_dns_management_client_enums.py deleted file mode 100644 index 82445b7a2eb3..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/private_dns_management_client_enums.py +++ /dev/null @@ -1,40 +0,0 @@ -# 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 enum import Enum - - -class ProvisioningState(str, Enum): - - creating = "Creating" - updating = "Updating" - deleting = "Deleting" - succeeded = "Succeeded" - failed = "Failed" - canceled = "Canceled" - - -class VirtualNetworkLinkState(str, Enum): - - in_progress = "InProgress" - completed = "Completed" - - -class RecordType(str, Enum): - - a = "A" - aaaa = "AAAA" - cname = "CNAME" - mx = "MX" - ptr = "PTR" - soa = "SOA" - srv = "SRV" - txt = "TXT" diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/private_zone.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/private_zone.py deleted file mode 100644 index da6f7358ef27..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/private_zone.py +++ /dev/null @@ -1,107 +0,0 @@ -# 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 .tracked_resource import TrackedResource - - -class PrivateZone(TrackedResource): - """Describes a Private DNS zone. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Example - - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Example - - 'Microsoft.Network/privateDnsZones'. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param location: The Azure Region where the resource lives - :type location: str - :param etag: The ETag of the zone. - :type etag: str - :ivar max_number_of_record_sets: The maximum number of record sets that - can be created in this Private DNS zone. This is a read-only property and - any attempt to set this value will be ignored. - :vartype max_number_of_record_sets: long - :ivar number_of_record_sets: The current number of record sets in this - Private DNS zone. This is a read-only property and any attempt to set this - value will be ignored. - :vartype number_of_record_sets: long - :ivar max_number_of_virtual_network_links: The maximum number of virtual - networks that can be linked to this Private DNS zone. This is a read-only - property and any attempt to set this value will be ignored. - :vartype max_number_of_virtual_network_links: long - :ivar number_of_virtual_network_links: The current number of virtual - networks that are linked to this Private DNS zone. This is a read-only - property and any attempt to set this value will be ignored. - :vartype number_of_virtual_network_links: long - :ivar max_number_of_virtual_network_links_with_registration: The maximum - number of virtual networks that can be linked to this Private DNS zone - with registration enabled. This is a read-only property and any attempt to - set this value will be ignored. - :vartype max_number_of_virtual_network_links_with_registration: long - :ivar number_of_virtual_network_links_with_registration: The current - number of virtual networks that are linked to this Private DNS zone with - registration enabled. This is a read-only property and any attempt to set - this value will be ignored. - :vartype number_of_virtual_network_links_with_registration: long - :ivar provisioning_state: The provisioning state of the resource. This is - a read-only property and any attempt to set this value will be ignored. - Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Failed', 'Canceled' - :vartype provisioning_state: str or - ~azure.mgmt.privatedns.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'max_number_of_record_sets': {'readonly': True}, - 'number_of_record_sets': {'readonly': True}, - 'max_number_of_virtual_network_links': {'readonly': True}, - 'number_of_virtual_network_links': {'readonly': True}, - 'max_number_of_virtual_network_links_with_registration': {'readonly': True}, - 'number_of_virtual_network_links_with_registration': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'max_number_of_record_sets': {'key': 'properties.maxNumberOfRecordSets', 'type': 'long'}, - 'number_of_record_sets': {'key': 'properties.numberOfRecordSets', 'type': 'long'}, - 'max_number_of_virtual_network_links': {'key': 'properties.maxNumberOfVirtualNetworkLinks', 'type': 'long'}, - 'number_of_virtual_network_links': {'key': 'properties.numberOfVirtualNetworkLinks', 'type': 'long'}, - 'max_number_of_virtual_network_links_with_registration': {'key': 'properties.maxNumberOfVirtualNetworkLinksWithRegistration', 'type': 'long'}, - 'number_of_virtual_network_links_with_registration': {'key': 'properties.numberOfVirtualNetworkLinksWithRegistration', 'type': 'long'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(PrivateZone, self).__init__(**kwargs) - self.etag = kwargs.get('etag', None) - self.max_number_of_record_sets = None - self.number_of_record_sets = None - self.max_number_of_virtual_network_links = None - self.number_of_virtual_network_links = None - self.max_number_of_virtual_network_links_with_registration = None - self.number_of_virtual_network_links_with_registration = None - self.provisioning_state = None diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/private_zone_paged.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/private_zone_paged.py deleted file mode 100644 index 21259ee5efcf..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/private_zone_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# 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 msrest.paging import Paged - - -class PrivateZonePaged(Paged): - """ - A paging container for iterating over a list of :class:`PrivateZone ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PrivateZone]'} - } - - def __init__(self, *args, **kwargs): - - super(PrivateZonePaged, self).__init__(*args, **kwargs) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/private_zone_py3.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/private_zone_py3.py deleted file mode 100644 index ca01b305e8b7..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/private_zone_py3.py +++ /dev/null @@ -1,107 +0,0 @@ -# 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 .tracked_resource_py3 import TrackedResource - - -class PrivateZone(TrackedResource): - """Describes a Private DNS zone. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Example - - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Example - - 'Microsoft.Network/privateDnsZones'. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param location: The Azure Region where the resource lives - :type location: str - :param etag: The ETag of the zone. - :type etag: str - :ivar max_number_of_record_sets: The maximum number of record sets that - can be created in this Private DNS zone. This is a read-only property and - any attempt to set this value will be ignored. - :vartype max_number_of_record_sets: long - :ivar number_of_record_sets: The current number of record sets in this - Private DNS zone. This is a read-only property and any attempt to set this - value will be ignored. - :vartype number_of_record_sets: long - :ivar max_number_of_virtual_network_links: The maximum number of virtual - networks that can be linked to this Private DNS zone. This is a read-only - property and any attempt to set this value will be ignored. - :vartype max_number_of_virtual_network_links: long - :ivar number_of_virtual_network_links: The current number of virtual - networks that are linked to this Private DNS zone. This is a read-only - property and any attempt to set this value will be ignored. - :vartype number_of_virtual_network_links: long - :ivar max_number_of_virtual_network_links_with_registration: The maximum - number of virtual networks that can be linked to this Private DNS zone - with registration enabled. This is a read-only property and any attempt to - set this value will be ignored. - :vartype max_number_of_virtual_network_links_with_registration: long - :ivar number_of_virtual_network_links_with_registration: The current - number of virtual networks that are linked to this Private DNS zone with - registration enabled. This is a read-only property and any attempt to set - this value will be ignored. - :vartype number_of_virtual_network_links_with_registration: long - :ivar provisioning_state: The provisioning state of the resource. This is - a read-only property and any attempt to set this value will be ignored. - Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Failed', 'Canceled' - :vartype provisioning_state: str or - ~azure.mgmt.privatedns.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'max_number_of_record_sets': {'readonly': True}, - 'number_of_record_sets': {'readonly': True}, - 'max_number_of_virtual_network_links': {'readonly': True}, - 'number_of_virtual_network_links': {'readonly': True}, - 'max_number_of_virtual_network_links_with_registration': {'readonly': True}, - 'number_of_virtual_network_links_with_registration': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'max_number_of_record_sets': {'key': 'properties.maxNumberOfRecordSets', 'type': 'long'}, - 'number_of_record_sets': {'key': 'properties.numberOfRecordSets', 'type': 'long'}, - 'max_number_of_virtual_network_links': {'key': 'properties.maxNumberOfVirtualNetworkLinks', 'type': 'long'}, - 'number_of_virtual_network_links': {'key': 'properties.numberOfVirtualNetworkLinks', 'type': 'long'}, - 'max_number_of_virtual_network_links_with_registration': {'key': 'properties.maxNumberOfVirtualNetworkLinksWithRegistration', 'type': 'long'}, - 'number_of_virtual_network_links_with_registration': {'key': 'properties.numberOfVirtualNetworkLinksWithRegistration', 'type': 'long'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__(self, *, tags=None, location: str=None, etag: str=None, **kwargs) -> None: - super(PrivateZone, self).__init__(tags=tags, location=location, **kwargs) - self.etag = etag - self.max_number_of_record_sets = None - self.number_of_record_sets = None - self.max_number_of_virtual_network_links = None - self.number_of_virtual_network_links = None - self.max_number_of_virtual_network_links_with_registration = None - self.number_of_virtual_network_links_with_registration = None - self.provisioning_state = None diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/proxy_resource.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/proxy_resource.py deleted file mode 100644 index 853224460eea..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/proxy_resource.py +++ /dev/null @@ -1,44 +0,0 @@ -# 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 .resource import Resource - - -class ProxyResource(Resource): - """The resource model definition for an ARM proxy resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Example - - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Example - - 'Microsoft.Network/privateDnsZones'. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(ProxyResource, self).__init__(**kwargs) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/proxy_resource_py3.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/proxy_resource_py3.py deleted file mode 100644 index e85909431e15..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/proxy_resource_py3.py +++ /dev/null @@ -1,44 +0,0 @@ -# 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 .resource_py3 import Resource - - -class ProxyResource(Resource): - """The resource model definition for an ARM proxy resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Example - - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Example - - 'Microsoft.Network/privateDnsZones'. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(ProxyResource, self).__init__(**kwargs) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/ptr_record.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/ptr_record.py deleted file mode 100644 index 1b14721c9855..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/ptr_record.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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 msrest.serialization import Model - - -class PtrRecord(Model): - """A PTR record. - - :param ptrdname: The PTR target domain name for this PTR record. - :type ptrdname: str - """ - - _attribute_map = { - 'ptrdname': {'key': 'ptrdname', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(PtrRecord, self).__init__(**kwargs) - self.ptrdname = kwargs.get('ptrdname', None) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/ptr_record_py3.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/ptr_record_py3.py deleted file mode 100644 index 523afce05a26..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/ptr_record_py3.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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 msrest.serialization import Model - - -class PtrRecord(Model): - """A PTR record. - - :param ptrdname: The PTR target domain name for this PTR record. - :type ptrdname: str - """ - - _attribute_map = { - 'ptrdname': {'key': 'ptrdname', 'type': 'str'}, - } - - def __init__(self, *, ptrdname: str=None, **kwargs) -> None: - super(PtrRecord, self).__init__(**kwargs) - self.ptrdname = ptrdname diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/record_set.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/record_set.py deleted file mode 100644 index e824e9459101..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/record_set.py +++ /dev/null @@ -1,100 +0,0 @@ -# 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 .proxy_resource import ProxyResource - - -class RecordSet(ProxyResource): - """Describes a DNS record set (a collection of DNS records with the same name - and type) in a Private DNS zone. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Example - - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Example - - 'Microsoft.Network/privateDnsZones'. - :vartype type: str - :param etag: The ETag of the record set. - :type etag: str - :param metadata: The metadata attached to the record set. - :type metadata: dict[str, str] - :param ttl: The TTL (time-to-live) of the records in the record set. - :type ttl: long - :ivar fqdn: Fully qualified domain name of the record set. - :vartype fqdn: str - :ivar is_auto_registered: Is the record set auto-registered in the Private - DNS zone through a virtual network link? - :vartype is_auto_registered: bool - :param a_records: The list of A records in the record set. - :type a_records: list[~azure.mgmt.privatedns.models.ARecord] - :param aaaa_records: The list of AAAA records in the record set. - :type aaaa_records: list[~azure.mgmt.privatedns.models.AaaaRecord] - :param cname_record: The CNAME record in the record set. - :type cname_record: ~azure.mgmt.privatedns.models.CnameRecord - :param mx_records: The list of MX records in the record set. - :type mx_records: list[~azure.mgmt.privatedns.models.MxRecord] - :param ptr_records: The list of PTR records in the record set. - :type ptr_records: list[~azure.mgmt.privatedns.models.PtrRecord] - :param soa_record: The SOA record in the record set. - :type soa_record: ~azure.mgmt.privatedns.models.SoaRecord - :param srv_records: The list of SRV records in the record set. - :type srv_records: list[~azure.mgmt.privatedns.models.SrvRecord] - :param txt_records: The list of TXT records in the record set. - :type txt_records: list[~azure.mgmt.privatedns.models.TxtRecord] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'is_auto_registered': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'ttl': {'key': 'properties.ttl', 'type': 'long'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'is_auto_registered': {'key': 'properties.isAutoRegistered', 'type': 'bool'}, - 'a_records': {'key': 'properties.aRecords', 'type': '[ARecord]'}, - 'aaaa_records': {'key': 'properties.aaaaRecords', 'type': '[AaaaRecord]'}, - 'cname_record': {'key': 'properties.cnameRecord', 'type': 'CnameRecord'}, - 'mx_records': {'key': 'properties.mxRecords', 'type': '[MxRecord]'}, - 'ptr_records': {'key': 'properties.ptrRecords', 'type': '[PtrRecord]'}, - 'soa_record': {'key': 'properties.soaRecord', 'type': 'SoaRecord'}, - 'srv_records': {'key': 'properties.srvRecords', 'type': '[SrvRecord]'}, - 'txt_records': {'key': 'properties.txtRecords', 'type': '[TxtRecord]'}, - } - - def __init__(self, **kwargs): - super(RecordSet, self).__init__(**kwargs) - self.etag = kwargs.get('etag', None) - self.metadata = kwargs.get('metadata', None) - self.ttl = kwargs.get('ttl', None) - self.fqdn = None - self.is_auto_registered = None - self.a_records = kwargs.get('a_records', None) - self.aaaa_records = kwargs.get('aaaa_records', None) - self.cname_record = kwargs.get('cname_record', None) - self.mx_records = kwargs.get('mx_records', None) - self.ptr_records = kwargs.get('ptr_records', None) - self.soa_record = kwargs.get('soa_record', None) - self.srv_records = kwargs.get('srv_records', None) - self.txt_records = kwargs.get('txt_records', None) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/record_set_paged.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/record_set_paged.py deleted file mode 100644 index 3b7aa7ee307a..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/record_set_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# 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 msrest.paging import Paged - - -class RecordSetPaged(Paged): - """ - A paging container for iterating over a list of :class:`RecordSet ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[RecordSet]'} - } - - def __init__(self, *args, **kwargs): - - super(RecordSetPaged, self).__init__(*args, **kwargs) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/record_set_py3.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/record_set_py3.py deleted file mode 100644 index b4c9b4431d7d..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/record_set_py3.py +++ /dev/null @@ -1,100 +0,0 @@ -# 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 .proxy_resource_py3 import ProxyResource - - -class RecordSet(ProxyResource): - """Describes a DNS record set (a collection of DNS records with the same name - and type) in a Private DNS zone. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Example - - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Example - - 'Microsoft.Network/privateDnsZones'. - :vartype type: str - :param etag: The ETag of the record set. - :type etag: str - :param metadata: The metadata attached to the record set. - :type metadata: dict[str, str] - :param ttl: The TTL (time-to-live) of the records in the record set. - :type ttl: long - :ivar fqdn: Fully qualified domain name of the record set. - :vartype fqdn: str - :ivar is_auto_registered: Is the record set auto-registered in the Private - DNS zone through a virtual network link? - :vartype is_auto_registered: bool - :param a_records: The list of A records in the record set. - :type a_records: list[~azure.mgmt.privatedns.models.ARecord] - :param aaaa_records: The list of AAAA records in the record set. - :type aaaa_records: list[~azure.mgmt.privatedns.models.AaaaRecord] - :param cname_record: The CNAME record in the record set. - :type cname_record: ~azure.mgmt.privatedns.models.CnameRecord - :param mx_records: The list of MX records in the record set. - :type mx_records: list[~azure.mgmt.privatedns.models.MxRecord] - :param ptr_records: The list of PTR records in the record set. - :type ptr_records: list[~azure.mgmt.privatedns.models.PtrRecord] - :param soa_record: The SOA record in the record set. - :type soa_record: ~azure.mgmt.privatedns.models.SoaRecord - :param srv_records: The list of SRV records in the record set. - :type srv_records: list[~azure.mgmt.privatedns.models.SrvRecord] - :param txt_records: The list of TXT records in the record set. - :type txt_records: list[~azure.mgmt.privatedns.models.TxtRecord] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'is_auto_registered': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'ttl': {'key': 'properties.ttl', 'type': 'long'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'is_auto_registered': {'key': 'properties.isAutoRegistered', 'type': 'bool'}, - 'a_records': {'key': 'properties.aRecords', 'type': '[ARecord]'}, - 'aaaa_records': {'key': 'properties.aaaaRecords', 'type': '[AaaaRecord]'}, - 'cname_record': {'key': 'properties.cnameRecord', 'type': 'CnameRecord'}, - 'mx_records': {'key': 'properties.mxRecords', 'type': '[MxRecord]'}, - 'ptr_records': {'key': 'properties.ptrRecords', 'type': '[PtrRecord]'}, - 'soa_record': {'key': 'properties.soaRecord', 'type': 'SoaRecord'}, - 'srv_records': {'key': 'properties.srvRecords', 'type': '[SrvRecord]'}, - 'txt_records': {'key': 'properties.txtRecords', 'type': '[TxtRecord]'}, - } - - def __init__(self, *, etag: str=None, metadata=None, ttl: int=None, a_records=None, aaaa_records=None, cname_record=None, mx_records=None, ptr_records=None, soa_record=None, srv_records=None, txt_records=None, **kwargs) -> None: - super(RecordSet, self).__init__(**kwargs) - self.etag = etag - self.metadata = metadata - self.ttl = ttl - self.fqdn = None - self.is_auto_registered = None - self.a_records = a_records - self.aaaa_records = aaaa_records - self.cname_record = cname_record - self.mx_records = mx_records - self.ptr_records = ptr_records - self.soa_record = soa_record - self.srv_records = srv_records - self.txt_records = txt_records diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/resource.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/resource.py deleted file mode 100644 index 002dca378d74..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/resource.py +++ /dev/null @@ -1,47 +0,0 @@ -# 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 msrest.serialization import Model - - -class Resource(Model): - """The core properties of ARM resources. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Example - - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Example - - 'Microsoft.Network/privateDnsZones'. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/resource_py3.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/resource_py3.py deleted file mode 100644 index 0312e9e1bb53..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/resource_py3.py +++ /dev/null @@ -1,47 +0,0 @@ -# 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 msrest.serialization import Model - - -class Resource(Model): - """The core properties of ARM resources. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Example - - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Example - - 'Microsoft.Network/privateDnsZones'. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/soa_record.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/soa_record.py deleted file mode 100644 index 8f2dce742499..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/soa_record.py +++ /dev/null @@ -1,54 +0,0 @@ -# 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 msrest.serialization import Model - - -class SoaRecord(Model): - """An SOA record. - - :param host: The domain name of the authoritative name server for this SOA - record. - :type host: str - :param email: The email contact for this SOA record. - :type email: str - :param serial_number: The serial number for this SOA record. - :type serial_number: long - :param refresh_time: The refresh value for this SOA record. - :type refresh_time: long - :param retry_time: The retry time for this SOA record. - :type retry_time: long - :param expire_time: The expire time for this SOA record. - :type expire_time: long - :param minimum_ttl: The minimum value for this SOA record. By convention - this is used to determine the negative caching duration. - :type minimum_ttl: long - """ - - _attribute_map = { - 'host': {'key': 'host', 'type': 'str'}, - 'email': {'key': 'email', 'type': 'str'}, - 'serial_number': {'key': 'serialNumber', 'type': 'long'}, - 'refresh_time': {'key': 'refreshTime', 'type': 'long'}, - 'retry_time': {'key': 'retryTime', 'type': 'long'}, - 'expire_time': {'key': 'expireTime', 'type': 'long'}, - 'minimum_ttl': {'key': 'minimumTtl', 'type': 'long'}, - } - - def __init__(self, **kwargs): - super(SoaRecord, self).__init__(**kwargs) - self.host = kwargs.get('host', None) - self.email = kwargs.get('email', None) - self.serial_number = kwargs.get('serial_number', None) - self.refresh_time = kwargs.get('refresh_time', None) - self.retry_time = kwargs.get('retry_time', None) - self.expire_time = kwargs.get('expire_time', None) - self.minimum_ttl = kwargs.get('minimum_ttl', None) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/soa_record_py3.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/soa_record_py3.py deleted file mode 100644 index c67060f17859..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/soa_record_py3.py +++ /dev/null @@ -1,54 +0,0 @@ -# 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 msrest.serialization import Model - - -class SoaRecord(Model): - """An SOA record. - - :param host: The domain name of the authoritative name server for this SOA - record. - :type host: str - :param email: The email contact for this SOA record. - :type email: str - :param serial_number: The serial number for this SOA record. - :type serial_number: long - :param refresh_time: The refresh value for this SOA record. - :type refresh_time: long - :param retry_time: The retry time for this SOA record. - :type retry_time: long - :param expire_time: The expire time for this SOA record. - :type expire_time: long - :param minimum_ttl: The minimum value for this SOA record. By convention - this is used to determine the negative caching duration. - :type minimum_ttl: long - """ - - _attribute_map = { - 'host': {'key': 'host', 'type': 'str'}, - 'email': {'key': 'email', 'type': 'str'}, - 'serial_number': {'key': 'serialNumber', 'type': 'long'}, - 'refresh_time': {'key': 'refreshTime', 'type': 'long'}, - 'retry_time': {'key': 'retryTime', 'type': 'long'}, - 'expire_time': {'key': 'expireTime', 'type': 'long'}, - 'minimum_ttl': {'key': 'minimumTtl', 'type': 'long'}, - } - - def __init__(self, *, host: str=None, email: str=None, serial_number: int=None, refresh_time: int=None, retry_time: int=None, expire_time: int=None, minimum_ttl: int=None, **kwargs) -> None: - super(SoaRecord, self).__init__(**kwargs) - self.host = host - self.email = email - self.serial_number = serial_number - self.refresh_time = refresh_time - self.retry_time = retry_time - self.expire_time = expire_time - self.minimum_ttl = minimum_ttl diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/srv_record.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/srv_record.py deleted file mode 100644 index c7dc5fcdcbbd..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/srv_record.py +++ /dev/null @@ -1,40 +0,0 @@ -# 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 msrest.serialization import Model - - -class SrvRecord(Model): - """An SRV record. - - :param priority: The priority value for this SRV record. - :type priority: int - :param weight: The weight value for this SRV record. - :type weight: int - :param port: The port value for this SRV record. - :type port: int - :param target: The target domain name for this SRV record. - :type target: str - """ - - _attribute_map = { - 'priority': {'key': 'priority', 'type': 'int'}, - 'weight': {'key': 'weight', 'type': 'int'}, - 'port': {'key': 'port', 'type': 'int'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SrvRecord, self).__init__(**kwargs) - self.priority = kwargs.get('priority', None) - self.weight = kwargs.get('weight', None) - self.port = kwargs.get('port', None) - self.target = kwargs.get('target', None) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/srv_record_py3.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/srv_record_py3.py deleted file mode 100644 index 9a464f27cb09..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/srv_record_py3.py +++ /dev/null @@ -1,40 +0,0 @@ -# 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 msrest.serialization import Model - - -class SrvRecord(Model): - """An SRV record. - - :param priority: The priority value for this SRV record. - :type priority: int - :param weight: The weight value for this SRV record. - :type weight: int - :param port: The port value for this SRV record. - :type port: int - :param target: The target domain name for this SRV record. - :type target: str - """ - - _attribute_map = { - 'priority': {'key': 'priority', 'type': 'int'}, - 'weight': {'key': 'weight', 'type': 'int'}, - 'port': {'key': 'port', 'type': 'int'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__(self, *, priority: int=None, weight: int=None, port: int=None, target: str=None, **kwargs) -> None: - super(SrvRecord, self).__init__(**kwargs) - self.priority = priority - self.weight = weight - self.port = port - self.target = target diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/sub_resource.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/sub_resource.py deleted file mode 100644 index 6ab81f55f21b..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/sub_resource.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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 msrest.serialization import Model - - -class SubResource(Model): - """Reference to another subresource. - - :param id: Resource ID. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SubResource, self).__init__(**kwargs) - self.id = kwargs.get('id', None) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/sub_resource_py3.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/sub_resource_py3.py deleted file mode 100644 index 8f4c4c816061..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/sub_resource_py3.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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 msrest.serialization import Model - - -class SubResource(Model): - """Reference to another subresource. - - :param id: Resource ID. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__(self, *, id: str=None, **kwargs) -> None: - super(SubResource, self).__init__(**kwargs) - self.id = id diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/tracked_resource.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/tracked_resource.py deleted file mode 100644 index 4579dd469812..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/tracked_resource.py +++ /dev/null @@ -1,52 +0,0 @@ -# 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 .resource import Resource - - -class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Example - - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Example - - 'Microsoft.Network/privateDnsZones'. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param location: The Azure Region where the resource lives - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs.get('location', None) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/tracked_resource_py3.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/tracked_resource_py3.py deleted file mode 100644 index edbd77a08f35..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/tracked_resource_py3.py +++ /dev/null @@ -1,52 +0,0 @@ -# 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 .resource_py3 import Resource - - -class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Example - - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Example - - 'Microsoft.Network/privateDnsZones'. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param location: The Azure Region where the resource lives - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__(self, *, tags=None, location: str=None, **kwargs) -> None: - super(TrackedResource, self).__init__(**kwargs) - self.tags = tags - self.location = location diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/txt_record.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/txt_record.py deleted file mode 100644 index 472f1f22b5d3..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/txt_record.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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 msrest.serialization import Model - - -class TxtRecord(Model): - """A TXT record. - - :param value: The text value of this TXT record. - :type value: list[str] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[str]'}, - } - - def __init__(self, **kwargs): - super(TxtRecord, self).__init__(**kwargs) - self.value = kwargs.get('value', None) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/txt_record_py3.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/txt_record_py3.py deleted file mode 100644 index 4faef766e859..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/txt_record_py3.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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 msrest.serialization import Model - - -class TxtRecord(Model): - """A TXT record. - - :param value: The text value of this TXT record. - :type value: list[str] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[str]'}, - } - - def __init__(self, *, value=None, **kwargs) -> None: - super(TxtRecord, self).__init__(**kwargs) - self.value = value diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/virtual_network_link.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/virtual_network_link.py deleted file mode 100644 index ea26327ae6b4..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/virtual_network_link.py +++ /dev/null @@ -1,81 +0,0 @@ -# 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 .tracked_resource import TrackedResource - - -class VirtualNetworkLink(TrackedResource): - """Describes a link to virtual network for a Private DNS zone. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Example - - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Example - - 'Microsoft.Network/privateDnsZones'. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param location: The Azure Region where the resource lives - :type location: str - :param etag: The ETag of the virtual network link. - :type etag: str - :param virtual_network: The reference of the virtual network. - :type virtual_network: ~azure.mgmt.privatedns.models.SubResource - :param registration_enabled: Is auto-registration of virtual machine - records in the virtual network in the Private DNS zone enabled? - :type registration_enabled: bool - :ivar virtual_network_link_state: The status of the virtual network link - to the Private DNS zone. Possible values are 'InProgress' and 'Done'. This - is a read-only property and any attempt to set this value will be ignored. - Possible values include: 'InProgress', 'Completed' - :vartype virtual_network_link_state: str or - ~azure.mgmt.privatedns.models.VirtualNetworkLinkState - :ivar provisioning_state: The provisioning state of the resource. This is - a read-only property and any attempt to set this value will be ignored. - Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Failed', 'Canceled' - :vartype provisioning_state: str or - ~azure.mgmt.privatedns.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'virtual_network_link_state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'virtual_network': {'key': 'properties.virtualNetwork', 'type': 'SubResource'}, - 'registration_enabled': {'key': 'properties.registrationEnabled', 'type': 'bool'}, - 'virtual_network_link_state': {'key': 'properties.virtualNetworkLinkState', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(VirtualNetworkLink, self).__init__(**kwargs) - self.etag = kwargs.get('etag', None) - self.virtual_network = kwargs.get('virtual_network', None) - self.registration_enabled = kwargs.get('registration_enabled', None) - self.virtual_network_link_state = None - self.provisioning_state = None diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/virtual_network_link_paged.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/virtual_network_link_paged.py deleted file mode 100644 index f177aa02de5b..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/virtual_network_link_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# 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 msrest.paging import Paged - - -class VirtualNetworkLinkPaged(Paged): - """ - A paging container for iterating over a list of :class:`VirtualNetworkLink ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[VirtualNetworkLink]'} - } - - def __init__(self, *args, **kwargs): - - super(VirtualNetworkLinkPaged, self).__init__(*args, **kwargs) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/virtual_network_link_py3.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/virtual_network_link_py3.py deleted file mode 100644 index 39a8e713f67d..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/virtual_network_link_py3.py +++ /dev/null @@ -1,81 +0,0 @@ -# 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 .tracked_resource_py3 import TrackedResource - - -class VirtualNetworkLink(TrackedResource): - """Describes a link to virtual network for a Private DNS zone. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Example - - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Example - - 'Microsoft.Network/privateDnsZones'. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param location: The Azure Region where the resource lives - :type location: str - :param etag: The ETag of the virtual network link. - :type etag: str - :param virtual_network: The reference of the virtual network. - :type virtual_network: ~azure.mgmt.privatedns.models.SubResource - :param registration_enabled: Is auto-registration of virtual machine - records in the virtual network in the Private DNS zone enabled? - :type registration_enabled: bool - :ivar virtual_network_link_state: The status of the virtual network link - to the Private DNS zone. Possible values are 'InProgress' and 'Done'. This - is a read-only property and any attempt to set this value will be ignored. - Possible values include: 'InProgress', 'Completed' - :vartype virtual_network_link_state: str or - ~azure.mgmt.privatedns.models.VirtualNetworkLinkState - :ivar provisioning_state: The provisioning state of the resource. This is - a read-only property and any attempt to set this value will be ignored. - Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Failed', 'Canceled' - :vartype provisioning_state: str or - ~azure.mgmt.privatedns.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'virtual_network_link_state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'virtual_network': {'key': 'properties.virtualNetwork', 'type': 'SubResource'}, - 'registration_enabled': {'key': 'properties.registrationEnabled', 'type': 'bool'}, - 'virtual_network_link_state': {'key': 'properties.virtualNetworkLinkState', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__(self, *, tags=None, location: str=None, etag: str=None, virtual_network=None, registration_enabled: bool=None, **kwargs) -> None: - super(VirtualNetworkLink, self).__init__(tags=tags, location=location, **kwargs) - self.etag = etag - self.virtual_network = virtual_network - self.registration_enabled = registration_enabled - self.virtual_network_link_state = None - self.provisioning_state = None diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/__init__.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/__init__.py index bc3e85267d5b..896182778bdb 100644 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/__init__.py +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/__init__.py @@ -1,17 +1,14 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from .private_zones_operations import PrivateZonesOperations -from .virtual_network_links_operations import VirtualNetworkLinksOperations -from .record_sets_operations import RecordSetsOperations +from ._private_zones_operations import PrivateZonesOperations +from ._virtual_network_links_operations import VirtualNetworkLinksOperations +from ._record_sets_operations import RecordSetsOperations __all__ = [ 'PrivateZonesOperations', diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/_private_zones_operations.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/_private_zones_operations.py new file mode 100644 index 000000000000..1eab66bba615 --- /dev/null +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/_private_zones_operations.py @@ -0,0 +1,665 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateZonesOperations(object): + """PrivateZonesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.privatedns.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name, # type: str + private_zone_name, # type: str + parameters, # type: "_models.PrivateZone" + if_match=None, # type: Optional[str] + if_none_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.PrivateZone"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateZone"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + if if_none_match is not None: + header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PrivateZone') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + 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('PrivateZone', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateZone', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + private_zone_name, # type: str + parameters, # type: "_models.PrivateZone" + if_match=None, # type: Optional[str] + if_none_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.PrivateZone"] + """Creates or updates a Private DNS zone. Does not modify Links to virtual networks or DNS records + within the zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param parameters: Parameters supplied to the CreateOrUpdate operation. + :type parameters: ~azure.mgmt.privatedns.models.PrivateZone + :param if_match: The ETag of the Private DNS zone. Omit this value to always overwrite the + current zone. Specify the last-seen ETag value to prevent accidentally overwriting any + concurrent changes. + :type if_match: str + :param if_none_match: Set to '*' to allow a new Private DNS zone to be created, but to prevent + updating an existing zone. Other values will be ignored. + :type if_none_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: True for ARMPolling, False for no polling, or a + polling object for 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 PrivateZone or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.privatedns.models.PrivateZone] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateZone"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + private_zone_name=private_zone_name, + parameters=parameters, + if_match=if_match, + if_none_match=if_none_match, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateZone', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + private_zone_name, # type: str + parameters, # type: "_models.PrivateZone" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.PrivateZone"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateZone"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PrivateZone') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + 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('PrivateZone', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + private_zone_name, # type: str + parameters, # type: "_models.PrivateZone" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.PrivateZone"] + """Updates a Private DNS zone. Does not modify virtual network links or DNS records within the + zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param parameters: Parameters supplied to the Update operation. + :type parameters: ~azure.mgmt.privatedns.models.PrivateZone + :param if_match: The ETag of the Private DNS zone. Omit this value to always overwrite the + current zone. Specify the last-seen ETag value to prevent accidentally overwriting any + concurrent changes. + :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: True for ARMPolling, False for no polling, or a + polling object for 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 PrivateZone or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.privatedns.models.PrivateZone] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateZone"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + private_zone_name=private_zone_name, + parameters=parameters, + if_match=if_match, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateZone', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + private_zone_name, # type: str + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + 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, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + private_zone_name, # type: str + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a Private DNS zone. WARNING: All DNS records in the zone will also be deleted. This + operation cannot be undone. Private DNS zone cannot be deleted unless all virtual network links + to it are removed. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param if_match: The ETag of the Private DNS zone. Omit this value to always delete the current + zone. Specify the last-seen ETag value to prevent accidentally deleting any concurrent changes. + :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: True for ARMPolling, False for no polling, or a + polling object for 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + private_zone_name=private_zone_name, + if_match=if_match, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + private_zone_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateZone" + """Gets a Private DNS zone. Retrieves the zone properties, but not the virtual networks links or + the record sets within the zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateZone, or the result of cls(response) + :rtype: ~azure.mgmt.privatedns.models.PrivateZone + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateZone"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateZone', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}'} # type: ignore + + def list( + self, + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateZoneListResult"] + """Lists the Private DNS zones in all resource groups in a subscription. + + :param top: The maximum number of Private DNS zones to return. If not specified, returns up to + 100 zones. + :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 PrivateZoneListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.privatedns.models.PrivateZoneListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateZoneListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateZoneListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/privateDnsZones'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateZoneListResult"] + """Lists the Private DNS zones within a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param top: The maximum number of record sets to return. If not specified, returns up to 100 + record sets. + :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 PrivateZoneListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.privatedns.models.PrivateZoneListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateZoneListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateZoneListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones'} # type: ignore diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/_record_sets_operations.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/_record_sets_operations.py new file mode 100644 index 000000000000..8be9ddaaf1fe --- /dev/null +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/_record_sets_operations.py @@ -0,0 +1,540 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class RecordSetsOperations(object): + """RecordSetsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.privatedns.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create_or_update( + self, + resource_group_name, # type: str + private_zone_name, # type: str + record_type, # type: Union[str, "_models.RecordType"] + relative_record_set_name, # type: str + parameters, # type: "_models.RecordSet" + if_match=None, # type: Optional[str] + if_none_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.RecordSet" + """Creates or updates a record set within a Private DNS zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param record_type: The type of DNS record in this record set. Record sets of type SOA can be + updated but not created (they are created when the Private DNS zone is created). + :type record_type: str or ~azure.mgmt.privatedns.models.RecordType + :param relative_record_set_name: The name of the record set, relative to the name of the zone. + :type relative_record_set_name: str + :param parameters: Parameters supplied to the CreateOrUpdate operation. + :type parameters: ~azure.mgmt.privatedns.models.RecordSet + :param if_match: The ETag of the record set. Omit this value to always overwrite the current + record set. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent + changes. + :type if_match: str + :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will be ignored. + :type if_none_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecordSet, or the result of cls(response) + :rtype: ~azure.mgmt.privatedns.models.RecordSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecordSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'recordType': self._serialize.url("record_type", record_type, 'str'), + 'relativeRecordSetName': self._serialize.url("relative_record_set_name", relative_record_set_name, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + if if_none_match is not None: + header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RecordSet') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + 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('RecordSet', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('RecordSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + private_zone_name, # type: str + record_type, # type: Union[str, "_models.RecordType"] + relative_record_set_name, # type: str + parameters, # type: "_models.RecordSet" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.RecordSet" + """Updates a record set within a Private DNS zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param record_type: The type of DNS record in this record set. + :type record_type: str or ~azure.mgmt.privatedns.models.RecordType + :param relative_record_set_name: The name of the record set, relative to the name of the zone. + :type relative_record_set_name: str + :param parameters: Parameters supplied to the Update operation. + :type parameters: ~azure.mgmt.privatedns.models.RecordSet + :param if_match: The ETag of the record set. Omit this value to always overwrite the current + record set. Specify the last-seen ETag value to prevent accidentally overwriting concurrent + changes. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecordSet, or the result of cls(response) + :rtype: ~azure.mgmt.privatedns.models.RecordSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecordSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'recordType': self._serialize.url("record_type", record_type, 'str'), + 'relativeRecordSetName': self._serialize.url("relative_record_set_name", relative_record_set_name, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RecordSet') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RecordSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + private_zone_name, # type: str + record_type, # type: Union[str, "_models.RecordType"] + relative_record_set_name, # type: str + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a record set from a Private DNS zone. This operation cannot be undone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param record_type: The type of DNS record in this record set. Record sets of type SOA cannot + be deleted (they are deleted when the Private DNS zone is deleted). + :type record_type: str or ~azure.mgmt.privatedns.models.RecordType + :param relative_record_set_name: The name of the record set, relative to the name of the zone. + :type relative_record_set_name: str + :param if_match: The ETag of the record set. Omit this value to always delete the current + record set. Specify the last-seen ETag value to prevent accidentally deleting any concurrent + changes. + :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 + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'recordType': self._serialize.url("record_type", record_type, 'str'), + 'relativeRecordSetName': self._serialize.url("relative_record_set_name", relative_record_set_name, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + private_zone_name, # type: str + record_type, # type: Union[str, "_models.RecordType"] + relative_record_set_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RecordSet" + """Gets a record set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param record_type: The type of DNS record in this record set. + :type record_type: str or ~azure.mgmt.privatedns.models.RecordType + :param relative_record_set_name: The name of the record set, relative to the name of the zone. + :type relative_record_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecordSet, or the result of cls(response) + :rtype: ~azure.mgmt.privatedns.models.RecordSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecordSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'recordType': self._serialize.url("record_type", record_type, 'str'), + 'relativeRecordSetName': self._serialize.url("relative_record_set_name", relative_record_set_name, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RecordSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}'} # type: ignore + + def list_by_type( + self, + resource_group_name, # type: str + private_zone_name, # type: str + record_type, # type: Union[str, "_models.RecordType"] + top=None, # type: Optional[int] + recordsetnamesuffix=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.RecordSetListResult"] + """Lists the record sets of a specified type in a Private DNS zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param record_type: The type of record sets to enumerate. + :type record_type: str or ~azure.mgmt.privatedns.models.RecordType + :param top: The maximum number of record sets to return. If not specified, returns up to 100 + record sets. + :type top: int + :param recordsetnamesuffix: The suffix label of the record set name to be used to filter the + record set enumeration. If this parameter is specified, the returned enumeration will only + contain records that end with ".:code:``". + :type recordsetnamesuffix: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecordSetListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.privatedns.models.RecordSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecordSetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_type.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'recordType': self._serialize.url("record_type", record_type, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if recordsetnamesuffix is not None: + query_parameters['$recordsetnamesuffix'] = self._serialize.query("recordsetnamesuffix", recordsetnamesuffix, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('RecordSetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_type.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + private_zone_name, # type: str + top=None, # type: Optional[int] + recordsetnamesuffix=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.RecordSetListResult"] + """Lists all record sets in a Private DNS zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param top: The maximum number of record sets to return. If not specified, returns up to 100 + record sets. + :type top: int + :param recordsetnamesuffix: The suffix label of the record set name to be used to filter the + record set enumeration. If this parameter is specified, the returned enumeration will only + contain records that end with ".:code:``". + :type recordsetnamesuffix: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecordSetListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.privatedns.models.RecordSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecordSetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if recordsetnamesuffix is not None: + query_parameters['$recordsetnamesuffix'] = self._serialize.query("recordsetnamesuffix", recordsetnamesuffix, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('RecordSetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/ALL'} # type: ignore diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/_virtual_network_links_operations.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/_virtual_network_links_operations.py new file mode 100644 index 000000000000..0782d913b393 --- /dev/null +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/_virtual_network_links_operations.py @@ -0,0 +1,619 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class VirtualNetworkLinksOperations(object): + """VirtualNetworkLinksOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.privatedns.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name, # type: str + private_zone_name, # type: str + virtual_network_link_name, # type: str + parameters, # type: "_models.VirtualNetworkLink" + if_match=None, # type: Optional[str] + if_none_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.VirtualNetworkLink"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VirtualNetworkLink"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'virtualNetworkLinkName': self._serialize.url("virtual_network_link_name", virtual_network_link_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + if if_none_match is not None: + header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VirtualNetworkLink') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + private_zone_name, # type: str + virtual_network_link_name, # type: str + parameters, # type: "_models.VirtualNetworkLink" + if_match=None, # type: Optional[str] + if_none_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualNetworkLink"] + """Creates or updates a virtual network link to the specified Private DNS zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param virtual_network_link_name: The name of the virtual network link. + :type virtual_network_link_name: str + :param parameters: Parameters supplied to the CreateOrUpdate operation. + :type parameters: ~azure.mgmt.privatedns.models.VirtualNetworkLink + :param if_match: The ETag of the virtual network link to the Private DNS zone. Omit this value + to always overwrite the current virtual network link. Specify the last-seen ETag value to + prevent accidentally overwriting any concurrent changes. + :type if_match: str + :param if_none_match: Set to '*' to allow a new virtual network link to the Private DNS zone to + be created, but to prevent updating an existing link. Other values will be ignored. + :type if_none_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: True for ARMPolling, False for no polling, or a + polling object for 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.privatedns.models.VirtualNetworkLink] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkLink"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + private_zone_name=private_zone_name, + virtual_network_link_name=virtual_network_link_name, + parameters=parameters, + if_match=if_match, + if_none_match=if_none_match, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualNetworkLink', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'virtualNetworkLinkName': self._serialize.url("virtual_network_link_name", virtual_network_link_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + private_zone_name, # type: str + virtual_network_link_name, # type: str + parameters, # type: "_models.VirtualNetworkLink" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.VirtualNetworkLink"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VirtualNetworkLink"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'virtualNetworkLinkName': self._serialize.url("virtual_network_link_name", virtual_network_link_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VirtualNetworkLink') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + 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 cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + private_zone_name, # type: str + virtual_network_link_name, # type: str + parameters, # type: "_models.VirtualNetworkLink" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualNetworkLink"] + """Updates a virtual network link to the specified Private DNS zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param virtual_network_link_name: The name of the virtual network link. + :type virtual_network_link_name: str + :param parameters: Parameters supplied to the Update operation. + :type parameters: ~azure.mgmt.privatedns.models.VirtualNetworkLink + :param if_match: The ETag of the virtual network link to the Private DNS zone. Omit this value + to always overwrite the current virtual network link. Specify the last-seen ETag value to + prevent accidentally overwriting any concurrent changes. + :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: True for ARMPolling, False for no polling, or a + polling object for 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.privatedns.models.VirtualNetworkLink] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkLink"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + private_zone_name=private_zone_name, + virtual_network_link_name=virtual_network_link_name, + parameters=parameters, + if_match=if_match, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualNetworkLink', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'virtualNetworkLinkName': self._serialize.url("virtual_network_link_name", virtual_network_link_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + private_zone_name, # type: str + virtual_network_link_name, # type: str + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'virtualNetworkLinkName': self._serialize.url("virtual_network_link_name", virtual_network_link_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + 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, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + private_zone_name, # type: str + virtual_network_link_name, # type: str + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a virtual network link to the specified Private DNS zone. WARNING: In case of a + registration virtual network, all auto-registered DNS records in the zone for the virtual + network will also be deleted. This operation cannot be undone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param virtual_network_link_name: The name of the virtual network link. + :type virtual_network_link_name: str + :param if_match: The ETag of the virtual network link to the Private DNS zone. Omit this value + to always delete the current zone. Specify the last-seen ETag value to prevent accidentally + deleting any concurrent changes. + :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: True for ARMPolling, False for no polling, or a + polling object for 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + private_zone_name=private_zone_name, + virtual_network_link_name=virtual_network_link_name, + if_match=if_match, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'virtualNetworkLinkName': self._serialize.url("virtual_network_link_name", virtual_network_link_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + private_zone_name, # type: str + virtual_network_link_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualNetworkLink" + """Gets a virtual network link to the specified Private DNS zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param virtual_network_link_name: The name of the virtual network link. + :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.privatedns.models.VirtualNetworkLink + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkLink"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'virtualNetworkLinkName': self._serialize.url("virtual_network_link_name", virtual_network_link_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualNetworkLink', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + private_zone_name, # type: str + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VirtualNetworkLinkListResult"] + """Lists the virtual network links to the specified Private DNS zone. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param private_zone_name: The name of the Private DNS zone (without a terminating dot). + :type private_zone_name: str + :param top: The maximum number of virtual network links to return. If not specified, returns up + to 100 virtual network links. + :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 VirtualNetworkLinkListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.privatedns.models.VirtualNetworkLinkListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkLinkListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualNetworkLinkListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks'} # type: ignore diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/private_zones_operations.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/private_zones_operations.py deleted file mode 100644 index 826c7e981c0e..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/private_zones_operations.py +++ /dev/null @@ -1,562 +0,0 @@ -# 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 uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling - -from .. import models - - -class PrivateZonesOperations(object): - """PrivateZonesOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2018-09-01". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-09-01" - - self.config = config - - - def _create_or_update_initial( - self, resource_group_name, private_zone_name, parameters, if_match=None, if_none_match=None, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.create_or_update.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'PrivateZone') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('PrivateZone', response) - if response.status_code == 201: - deserialized = self._deserialize('PrivateZone', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def create_or_update( - self, resource_group_name, private_zone_name, parameters, if_match=None, if_none_match=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Creates or updates a Private DNS zone. Does not modify Links to virtual - networks or DNS records within the zone. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param private_zone_name: The name of the Private DNS zone (without a - terminating dot). - :type private_zone_name: str - :param parameters: Parameters supplied to the CreateOrUpdate - operation. - :type parameters: ~azure.mgmt.privatedns.models.PrivateZone - :param if_match: The ETag of the Private DNS zone. Omit this value to - always overwrite the current zone. Specify the last-seen ETag value to - prevent accidentally overwriting any concurrent changes. - :type if_match: str - :param if_none_match: Set to '*' to allow a new Private DNS zone to be - created, but to prevent updating an existing zone. Other values will - be ignored. - :type if_none_match: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns PrivateZone or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.privatedns.models.PrivateZone] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.privatedns.models.PrivateZone]] - :raises: :class:`CloudError` - """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - private_zone_name=private_zone_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('PrivateZone', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}'} - - - def _update_initial( - self, resource_group_name, private_zone_name, parameters, if_match=None, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.update.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'PrivateZone') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('PrivateZone', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def update( - self, resource_group_name, private_zone_name, parameters, if_match=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Updates a Private DNS zone. Does not modify virtual network links or - DNS records within the zone. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param private_zone_name: The name of the Private DNS zone (without a - terminating dot). - :type private_zone_name: str - :param parameters: Parameters supplied to the Update operation. - :type parameters: ~azure.mgmt.privatedns.models.PrivateZone - :param if_match: The ETag of the Private DNS zone. Omit this value to - always overwrite the current zone. Specify the last-seen ETag value to - prevent accidentally overwriting any concurrent changes. - :type if_match: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns PrivateZone or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.privatedns.models.PrivateZone] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.privatedns.models.PrivateZone]] - :raises: :class:`CloudError` - """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - private_zone_name=private_zone_name, - parameters=parameters, - if_match=if_match, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('PrivateZone', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}'} - - - def _delete_initial( - self, resource_group_name, private_zone_name, if_match=None, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, private_zone_name, if_match=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Deletes a Private DNS zone. WARNING: All DNS records in the zone will - also be deleted. This operation cannot be undone. Private DNS zone - cannot be deleted unless all virtual network links to it are removed. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param private_zone_name: The name of the Private DNS zone (without a - terminating dot). - :type private_zone_name: str - :param if_match: The ETag of the Private DNS zone. Omit this value to - always delete the current zone. Specify the last-seen ETag value to - prevent accidentally deleting any concurrent changes. - :type if_match: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - private_zone_name=private_zone_name, - if_match=if_match, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}'} - - def get( - self, resource_group_name, private_zone_name, custom_headers=None, raw=False, **operation_config): - """Gets a Private DNS zone. Retrieves the zone properties, but not the - virtual networks links or the record sets within the zone. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param private_zone_name: The name of the Private DNS zone (without a - terminating dot). - :type private_zone_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateZone or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.privatedns.models.PrivateZone or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('PrivateZone', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}'} - - def list( - self, top=None, custom_headers=None, raw=False, **operation_config): - """Lists the Private DNS zones in all resource groups in a subscription. - - :param top: The maximum number of Private DNS zones to return. If not - specified, returns up to 100 zones. - :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PrivateZone - :rtype: - ~azure.mgmt.privatedns.models.PrivateZonePaged[~azure.mgmt.privatedns.models.PrivateZone] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.PrivateZonePaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.PrivateZonePaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/privateDnsZones'} - - def list_by_resource_group( - self, resource_group_name, top=None, custom_headers=None, raw=False, **operation_config): - """Lists the Private DNS zones within a resource group. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param top: The maximum number of record sets to return. If not - specified, returns up to 100 record sets. - :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PrivateZone - :rtype: - ~azure.mgmt.privatedns.models.PrivateZonePaged[~azure.mgmt.privatedns.models.PrivateZone] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.PrivateZonePaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.PrivateZonePaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones'} diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/record_sets_operations.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/record_sets_operations.py deleted file mode 100644 index 2410f80f7a8f..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/record_sets_operations.py +++ /dev/null @@ -1,529 +0,0 @@ -# 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 uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError - -from .. import models - - -class RecordSetsOperations(object): - """RecordSetsOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2018-09-01". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-09-01" - - self.config = config - - def create_or_update( - self, resource_group_name, private_zone_name, record_type, relative_record_set_name, parameters, if_match=None, if_none_match=None, custom_headers=None, raw=False, **operation_config): - """Creates or updates a record set within a Private DNS zone. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param private_zone_name: The name of the Private DNS zone (without a - terminating dot). - :type private_zone_name: str - :param record_type: The type of DNS record in this record set. Record - sets of type SOA can be updated but not created (they are created when - the Private DNS zone is created). Possible values include: 'A', - 'AAAA', 'CNAME', 'MX', 'PTR', 'SOA', 'SRV', 'TXT' - :type record_type: str or ~azure.mgmt.privatedns.models.RecordType - :param relative_record_set_name: The name of the record set, relative - to the name of the zone. - :type relative_record_set_name: str - :param parameters: Parameters supplied to the CreateOrUpdate - operation. - :type parameters: ~azure.mgmt.privatedns.models.RecordSet - :param if_match: The ETag of the record set. Omit this value to always - overwrite the current record set. Specify the last-seen ETag value to - prevent accidentally overwriting any concurrent changes. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be - created, but to prevent updating an existing record set. Other values - will be ignored. - :type if_none_match: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RecordSet or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.privatedns.models.RecordSet or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.create_or_update.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), - 'recordType': self._serialize.url("record_type", record_type, 'RecordType'), - 'relativeRecordSetName': self._serialize.url("relative_record_set_name", relative_record_set_name, 'str', skip_quote=True), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'RecordSet') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RecordSet', response) - if response.status_code == 201: - deserialized = self._deserialize('RecordSet', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}'} - - def update( - self, resource_group_name, private_zone_name, record_type, relative_record_set_name, parameters, if_match=None, custom_headers=None, raw=False, **operation_config): - """Updates a record set within a Private DNS zone. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param private_zone_name: The name of the Private DNS zone (without a - terminating dot). - :type private_zone_name: str - :param record_type: The type of DNS record in this record set. - Possible values include: 'A', 'AAAA', 'CNAME', 'MX', 'PTR', 'SOA', - 'SRV', 'TXT' - :type record_type: str or ~azure.mgmt.privatedns.models.RecordType - :param relative_record_set_name: The name of the record set, relative - to the name of the zone. - :type relative_record_set_name: str - :param parameters: Parameters supplied to the Update operation. - :type parameters: ~azure.mgmt.privatedns.models.RecordSet - :param if_match: The ETag of the record set. Omit this value to always - overwrite the current record set. Specify the last-seen ETag value to - prevent accidentally overwriting concurrent changes. - :type if_match: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RecordSet or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.privatedns.models.RecordSet or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.update.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), - 'recordType': self._serialize.url("record_type", record_type, 'RecordType'), - 'relativeRecordSetName': self._serialize.url("relative_record_set_name", relative_record_set_name, 'str', skip_quote=True), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'RecordSet') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RecordSet', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}'} - - def delete( - self, resource_group_name, private_zone_name, record_type, relative_record_set_name, if_match=None, custom_headers=None, raw=False, **operation_config): - """Deletes a record set from a Private DNS zone. This operation cannot be - undone. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param private_zone_name: The name of the Private DNS zone (without a - terminating dot). - :type private_zone_name: str - :param record_type: The type of DNS record in this record set. Record - sets of type SOA cannot be deleted (they are deleted when the Private - DNS zone is deleted). Possible values include: 'A', 'AAAA', 'CNAME', - 'MX', 'PTR', 'SOA', 'SRV', 'TXT' - :type record_type: str or ~azure.mgmt.privatedns.models.RecordType - :param relative_record_set_name: The name of the record set, relative - to the name of the zone. - :type relative_record_set_name: str - :param if_match: The ETag of the record set. Omit this value to always - delete the current record set. Specify the last-seen ETag value to - prevent accidentally deleting any concurrent changes. - :type if_match: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), - 'recordType': self._serialize.url("record_type", record_type, 'RecordType'), - 'relativeRecordSetName': self._serialize.url("relative_record_set_name", relative_record_set_name, 'str', skip_quote=True), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}'} - - def get( - self, resource_group_name, private_zone_name, record_type, relative_record_set_name, custom_headers=None, raw=False, **operation_config): - """Gets a record set. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param private_zone_name: The name of the Private DNS zone (without a - terminating dot). - :type private_zone_name: str - :param record_type: The type of DNS record in this record set. - Possible values include: 'A', 'AAAA', 'CNAME', 'MX', 'PTR', 'SOA', - 'SRV', 'TXT' - :type record_type: str or ~azure.mgmt.privatedns.models.RecordType - :param relative_record_set_name: The name of the record set, relative - to the name of the zone. - :type relative_record_set_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RecordSet or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.privatedns.models.RecordSet or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), - 'recordType': self._serialize.url("record_type", record_type, 'RecordType'), - 'relativeRecordSetName': self._serialize.url("relative_record_set_name", relative_record_set_name, 'str', skip_quote=True), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RecordSet', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}'} - - def list_by_type( - self, resource_group_name, private_zone_name, record_type, top=None, recordsetnamesuffix=None, custom_headers=None, raw=False, **operation_config): - """Lists the record sets of a specified type in a Private DNS zone. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param private_zone_name: The name of the Private DNS zone (without a - terminating dot). - :type private_zone_name: str - :param record_type: The type of record sets to enumerate. Possible - values include: 'A', 'AAAA', 'CNAME', 'MX', 'PTR', 'SOA', 'SRV', 'TXT' - :type record_type: str or ~azure.mgmt.privatedns.models.RecordType - :param top: The maximum number of record sets to return. If not - specified, returns up to 100 record sets. - :type top: int - :param recordsetnamesuffix: The suffix label of the record set name to - be used to filter the record set enumeration. If this parameter is - specified, the returned enumeration will only contain records that end - with ".". - :type recordsetnamesuffix: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of RecordSet - :rtype: - ~azure.mgmt.privatedns.models.RecordSetPaged[~azure.mgmt.privatedns.models.RecordSet] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_type.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), - 'recordType': self._serialize.url("record_type", record_type, 'RecordType'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - if recordsetnamesuffix is not None: - query_parameters['$recordsetnamesuffix'] = self._serialize.query("recordsetnamesuffix", recordsetnamesuffix, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.RecordSetPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.RecordSetPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_type.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}'} - - def list( - self, resource_group_name, private_zone_name, top=None, recordsetnamesuffix=None, custom_headers=None, raw=False, **operation_config): - """Lists all record sets in a Private DNS zone. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param private_zone_name: The name of the Private DNS zone (without a - terminating dot). - :type private_zone_name: str - :param top: The maximum number of record sets to return. If not - specified, returns up to 100 record sets. - :type top: int - :param recordsetnamesuffix: The suffix label of the record set name to - be used to filter the record set enumeration. If this parameter is - specified, the returned enumeration will only contain records that end - with ".". - :type recordsetnamesuffix: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of RecordSet - :rtype: - ~azure.mgmt.privatedns.models.RecordSetPaged[~azure.mgmt.privatedns.models.RecordSet] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - if recordsetnamesuffix is not None: - query_parameters['$recordsetnamesuffix'] = self._serialize.query("recordsetnamesuffix", recordsetnamesuffix, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.RecordSetPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.RecordSetPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/ALL'} diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/virtual_network_links_operations.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/virtual_network_links_operations.py deleted file mode 100644 index 54f2ba7411b7..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/operations/virtual_network_links_operations.py +++ /dev/null @@ -1,518 +0,0 @@ -# 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 uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling - -from .. import models - - -class VirtualNetworkLinksOperations(object): - """VirtualNetworkLinksOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2018-09-01". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-09-01" - - self.config = config - - - def _create_or_update_initial( - self, resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match=None, if_none_match=None, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.create_or_update.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), - 'virtualNetworkLinkName': self._serialize.url("virtual_network_link_name", virtual_network_link_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'VirtualNetworkLink') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkLink', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkLink', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def create_or_update( - self, resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match=None, if_none_match=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Creates or updates a virtual network link to the specified Private DNS - zone. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param private_zone_name: The name of the Private DNS zone (without a - terminating dot). - :type private_zone_name: str - :param virtual_network_link_name: The name of the virtual network - link. - :type virtual_network_link_name: str - :param parameters: Parameters supplied to the CreateOrUpdate - operation. - :type parameters: ~azure.mgmt.privatedns.models.VirtualNetworkLink - :param if_match: The ETag of the virtual network link to the Private - DNS zone. Omit this value to always overwrite the current virtual - network link. Specify the last-seen ETag value to prevent accidentally - overwriting any concurrent changes. - :type if_match: str - :param if_none_match: Set to '*' to allow a new virtual network link - to the Private DNS zone to be created, but to prevent updating an - existing link. Other values will be ignored. - :type if_none_match: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns VirtualNetworkLink or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.privatedns.models.VirtualNetworkLink] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.privatedns.models.VirtualNetworkLink]] - :raises: :class:`CloudError` - """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - private_zone_name=private_zone_name, - virtual_network_link_name=virtual_network_link_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('VirtualNetworkLink', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}'} - - - def _update_initial( - self, resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match=None, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.update.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), - 'virtualNetworkLinkName': self._serialize.url("virtual_network_link_name", virtual_network_link_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'VirtualNetworkLink') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkLink', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def update( - self, resource_group_name, private_zone_name, virtual_network_link_name, parameters, if_match=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Updates a virtual network link to the specified Private DNS zone. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param private_zone_name: The name of the Private DNS zone (without a - terminating dot). - :type private_zone_name: str - :param virtual_network_link_name: The name of the virtual network - link. - :type virtual_network_link_name: str - :param parameters: Parameters supplied to the Update operation. - :type parameters: ~azure.mgmt.privatedns.models.VirtualNetworkLink - :param if_match: The ETag of the virtual network link to the Private - DNS zone. Omit this value to always overwrite the current virtual - network link. Specify the last-seen ETag value to prevent accidentally - overwriting any concurrent changes. - :type if_match: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns VirtualNetworkLink or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.privatedns.models.VirtualNetworkLink] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.privatedns.models.VirtualNetworkLink]] - :raises: :class:`CloudError` - """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - private_zone_name=private_zone_name, - virtual_network_link_name=virtual_network_link_name, - parameters=parameters, - if_match=if_match, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('VirtualNetworkLink', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}'} - - - def _delete_initial( - self, resource_group_name, private_zone_name, virtual_network_link_name, if_match=None, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), - 'virtualNetworkLinkName': self._serialize.url("virtual_network_link_name", virtual_network_link_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, private_zone_name, virtual_network_link_name, if_match=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Deletes a virtual network link to the specified Private DNS zone. - WARNING: In case of a registration virtual network, all auto-registered - DNS records in the zone for the virtual network will also be deleted. - This operation cannot be undone. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param private_zone_name: The name of the Private DNS zone (without a - terminating dot). - :type private_zone_name: str - :param virtual_network_link_name: The name of the virtual network - link. - :type virtual_network_link_name: str - :param if_match: The ETag of the virtual network link to the Private - DNS zone. Omit this value to always delete the current zone. Specify - the last-seen ETag value to prevent accidentally deleting any - concurrent changes. - :type if_match: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - private_zone_name=private_zone_name, - virtual_network_link_name=virtual_network_link_name, - if_match=if_match, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}'} - - def get( - self, resource_group_name, private_zone_name, virtual_network_link_name, custom_headers=None, raw=False, **operation_config): - """Gets a virtual network link to the specified Private DNS zone. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param private_zone_name: The name of the Private DNS zone (without a - terminating dot). - :type private_zone_name: str - :param virtual_network_link_name: The name of the virtual network - link. - :type virtual_network_link_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VirtualNetworkLink or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.privatedns.models.VirtualNetworkLink or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), - 'virtualNetworkLinkName': self._serialize.url("virtual_network_link_name", virtual_network_link_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkLink', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}'} - - def list( - self, resource_group_name, private_zone_name, top=None, custom_headers=None, raw=False, **operation_config): - """Lists the virtual network links to the specified Private DNS zone. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param private_zone_name: The name of the Private DNS zone (without a - terminating dot). - :type private_zone_name: str - :param top: The maximum number of virtual network links to return. If - not specified, returns up to 100 virtual network links. - :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of VirtualNetworkLink - :rtype: - ~azure.mgmt.privatedns.models.VirtualNetworkLinkPaged[~azure.mgmt.privatedns.models.VirtualNetworkLink] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'privateZoneName': self._serialize.url("private_zone_name", private_zone_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.VirtualNetworkLinkPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.VirtualNetworkLinkPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks'} diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/private_dns_management_client.py b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/private_dns_management_client.py deleted file mode 100644 index a53a017f030a..000000000000 --- a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/private_dns_management_client.py +++ /dev/null @@ -1,95 +0,0 @@ -# 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 msrest.service_client import SDKClient -from msrest import Serializer, Deserializer -from msrestazure import AzureConfiguration -from .version import VERSION -from .operations.private_zones_operations import PrivateZonesOperations -from .operations.virtual_network_links_operations import VirtualNetworkLinksOperations -from .operations.record_sets_operations import RecordSetsOperations -from . import models - - -class PrivateDnsManagementClientConfiguration(AzureConfiguration): - """Configuration for PrivateDnsManagementClient - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Gets subscription credentials which uniquely - identify Microsoft Azure subscription. The subscription ID forms part of - the URI for every service call. - :type subscription_id: str - :param str base_url: Service URL - """ - - def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - if not base_url: - base_url = 'https://management.azure.com' - - super(PrivateDnsManagementClientConfiguration, self).__init__(base_url) - - self.add_user_agent('azure-mgmt-privatedns/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials - self.subscription_id = subscription_id - - -class PrivateDnsManagementClient(SDKClient): - """The Private DNS Management Client. - - :ivar config: Configuration for client. - :vartype config: PrivateDnsManagementClientConfiguration - - :ivar private_zones: PrivateZones operations - :vartype private_zones: azure.mgmt.privatedns.operations.PrivateZonesOperations - :ivar virtual_network_links: VirtualNetworkLinks operations - :vartype virtual_network_links: azure.mgmt.privatedns.operations.VirtualNetworkLinksOperations - :ivar record_sets: RecordSets operations - :vartype record_sets: azure.mgmt.privatedns.operations.RecordSetsOperations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Gets subscription credentials which uniquely - identify Microsoft Azure subscription. The subscription ID forms part of - the URI for every service call. - :type subscription_id: str - :param str base_url: Service URL - """ - - def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = PrivateDnsManagementClientConfiguration(credentials, subscription_id, base_url) - super(PrivateDnsManagementClient, self).__init__(self.config.credentials, self.config) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2018-09-01' - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - - self.private_zones = PrivateZonesOperations( - self._client, self.config, self._serialize, self._deserialize) - self.virtual_network_links = VirtualNetworkLinksOperations( - self._client, self.config, self._serialize, self._deserialize) - self.record_sets = RecordSetsOperations( - self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/py.typed b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/network/azure-mgmt-privatedns/setup.py b/sdk/network/azure-mgmt-privatedns/setup.py index ed8b38d9b7d6..b26d85de0ec9 100644 --- a/sdk/network/azure-mgmt-privatedns/setup.py +++ b/sdk/network/azure-mgmt-privatedns/setup.py @@ -81,7 +81,7 @@ ]), install_requires=[ 'msrest>=0.5.0', - 'msrestazure>=0.4.32,<2.0.0', + 'azure-mgmt-core>=1.2.0,<2.0.0', 'azure-common~=1.1', ], extras_require={