diff --git a/sdk/compute/azure-mgmt-avs/CHANGELOG.md b/sdk/compute/azure-mgmt-avs/CHANGELOG.md new file mode 100644 index 000000000000..14f871d5abe8 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/CHANGELOG.md @@ -0,0 +1,93 @@ +# Release History + +## 7.0.0b1 (2021-07-13) + +This is beta preview version. + +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. + + +## 2.0.0 (2021-07-13) + +**Features** + + - Model PrivateCloud has a new parameter external_cloud_links + - Model MetricDimension has a new parameter internal_name + - Model MetricDimension has a new parameter to_be_exported_for_shoebox + - Added operation PrivateCloudsOperations.rotate_vcenter_password + - Added operation PrivateCloudsOperations.rotate_nsxt_password + - Added operation group ScriptExecutionsOperations + - Added operation group DatastoresOperations + - Added operation group CloudLinksOperations + - Added operation group ScriptPackagesOperations + - Added operation group WorkloadNetworksOperations + - Added operation group ScriptCmdletsOperations + - Added operation group AddonsOperations + - Added operation group GlobalReachConnectionsOperations + +**Breaking changes** + + - Operation HcxEnterpriseSitesOperations.create_or_update has a new signature + - Operation AuthorizationsOperations.create_or_update has a new signature + +## 1.0.0 (2020-11-11) + +**Features** + + - Model Operation has a new parameter properties + - Model Operation has a new parameter is_data_action + - Model Operation has a new parameter origin + - Model ManagementCluster has a new parameter provisioning_state + +**Breaking changes** + + - Operation ClustersOperations.create_or_update has a new signature + - Operation ClustersOperations.create_or_update has a new signature + +## 1.0.0rc1 (2020-07-03) + +**Features** + + - Model Endpoints has a new parameter hcx_cloud_manager + - Model Cluster has a new parameter hosts + - Model Cluster has a new parameter cluster_id + - Model Cluster has a new parameter cluster_size + - Model Cluster has a new parameter provisioning_state + - Added operation group HcxEnterpriseSitesOperations + - Added operation group AuthorizationsOperations + +**Breaking changes** + + - Operation ClustersOperations.update has a new signature + - Operation ClustersOperations.create_or_update has a new signature + - Operation PrivateCloudsOperations.update has a new signature + - Operation ClustersOperations.create_or_update has a new signature + - Model Circuit no longer has parameter authorizations + - Model Cluster no longer has parameter properties + - Model Cluster has a new required parameter sku + - Model PrivateCloud has a new signature + - Model ExpressRouteAuthorization has a new signature diff --git a/sdk/compute/azure-mgmt-avs/MANIFEST.in b/sdk/compute/azure-mgmt-avs/MANIFEST.in new file mode 100644 index 000000000000..3a9b6517412b --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/sdk/compute/azure-mgmt-avs/README.md b/sdk/compute/azure-mgmt-avs/README.md new file mode 100644 index 000000000000..ab08518fb183 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure Avs Management Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +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 [Avs 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 the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-avs%2FREADME.png) diff --git a/sdk/compute/azure-mgmt-avs/_meta.json b/sdk/compute/azure-mgmt-avs/_meta.json new file mode 100644 index 000000000000..b325856a4a38 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.3", + "@autorest/modelerfour@4.19.2" + ], + "commit": "b91af17cf7e5d480dec66f50fa96b2e2f13a83f0", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/vmware/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.3 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "readme": "specification/vmware/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-avs/azure/__init__.py b/sdk/compute/azure-mgmt-avs/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/__init__.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/__init__.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/__init__.py new file mode 100644 index 000000000000..45ca0700235f --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/__init__.py @@ -0,0 +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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._avs_client import AVSClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['AVSClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_avs_client.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_avs_client.py new file mode 100644 index 000000000000..60ff0e7759ad --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_avs_client.py @@ -0,0 +1,154 @@ +# 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 azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import AVSClientConfiguration +from .operations import Operations +from .operations import LocationsOperations +from .operations import PrivateCloudsOperations +from .operations import ClustersOperations +from .operations import DatastoresOperations +from .operations import HcxEnterpriseSitesOperations +from .operations import AuthorizationsOperations +from .operations import GlobalReachConnectionsOperations +from .operations import WorkloadNetworksOperations +from .operations import CloudLinksOperations +from .operations import AddonsOperations +from .operations import ScriptPackagesOperations +from .operations import ScriptCmdletsOperations +from .operations import ScriptExecutionsOperations +from . import models + + +class AVSClient(object): + """Azure VMware Solution API. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.avs.operations.Operations + :ivar locations: LocationsOperations operations + :vartype locations: azure.mgmt.avs.operations.LocationsOperations + :ivar private_clouds: PrivateCloudsOperations operations + :vartype private_clouds: azure.mgmt.avs.operations.PrivateCloudsOperations + :ivar clusters: ClustersOperations operations + :vartype clusters: azure.mgmt.avs.operations.ClustersOperations + :ivar datastores: DatastoresOperations operations + :vartype datastores: azure.mgmt.avs.operations.DatastoresOperations + :ivar hcx_enterprise_sites: HcxEnterpriseSitesOperations operations + :vartype hcx_enterprise_sites: azure.mgmt.avs.operations.HcxEnterpriseSitesOperations + :ivar authorizations: AuthorizationsOperations operations + :vartype authorizations: azure.mgmt.avs.operations.AuthorizationsOperations + :ivar global_reach_connections: GlobalReachConnectionsOperations operations + :vartype global_reach_connections: azure.mgmt.avs.operations.GlobalReachConnectionsOperations + :ivar workload_networks: WorkloadNetworksOperations operations + :vartype workload_networks: azure.mgmt.avs.operations.WorkloadNetworksOperations + :ivar cloud_links: CloudLinksOperations operations + :vartype cloud_links: azure.mgmt.avs.operations.CloudLinksOperations + :ivar addons: AddonsOperations operations + :vartype addons: azure.mgmt.avs.operations.AddonsOperations + :ivar script_packages: ScriptPackagesOperations operations + :vartype script_packages: azure.mgmt.avs.operations.ScriptPackagesOperations + :ivar script_cmdlets: ScriptCmdletsOperations operations + :vartype script_cmdlets: azure.mgmt.avs.operations.ScriptCmdletsOperations + :ivar script_executions: ScriptExecutionsOperations operations + :vartype script_executions: azure.mgmt.avs.operations.ScriptExecutionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :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 = AVSClientConfiguration(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._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.locations = LocationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_clouds = PrivateCloudsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.clusters = ClustersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.datastores = DatastoresOperations( + self._client, self._config, self._serialize, self._deserialize) + self.hcx_enterprise_sites = HcxEnterpriseSitesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.authorizations = AuthorizationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.global_reach_connections = GlobalReachConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.workload_networks = WorkloadNetworksOperations( + self._client, self._config, self._serialize, self._deserialize) + self.cloud_links = CloudLinksOperations( + self._client, self._config, self._serialize, self._deserialize) + self.addons = AddonsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.script_packages = ScriptPackagesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.script_cmdlets = ScriptCmdletsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.script_executions = ScriptExecutionsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> AVSClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_configuration.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_configuration.py new file mode 100644 index 000000000000..345b679841e1 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_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 AVSClientConfiguration(Configuration): + """Configuration for AVSClient. + + 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: The ID of the target subscription. + :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(AVSClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-06-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-avs/{}'.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/compute/azure-mgmt-avs/azure/mgmt/avs/_metadata.json b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_metadata.json new file mode 100644 index 000000000000..d9558b9e4d7b --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_metadata.json @@ -0,0 +1,116 @@ +{ + "chosen_version": "2021-06-01", + "total_api_version_list": ["2021-06-01"], + "client": { + "name": "AVSClient", + "filename": "_avs_client", + "description": "Azure VMware Solution API.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AVSClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AVSClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "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": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"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: str,", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "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, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "locations": "LocationsOperations", + "private_clouds": "PrivateCloudsOperations", + "clusters": "ClustersOperations", + "datastores": "DatastoresOperations", + "hcx_enterprise_sites": "HcxEnterpriseSitesOperations", + "authorizations": "AuthorizationsOperations", + "global_reach_connections": "GlobalReachConnectionsOperations", + "workload_networks": "WorkloadNetworksOperations", + "cloud_links": "CloudLinksOperations", + "addons": "AddonsOperations", + "script_packages": "ScriptPackagesOperations", + "script_cmdlets": "ScriptCmdletsOperations", + "script_executions": "ScriptExecutionsOperations" + } +} \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_version.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_version.py new file mode 100644 index 000000000000..efe7276fe05f --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_version.py @@ -0,0 +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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "7.0.0b1" diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/__init__.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/__init__.py new file mode 100644 index 000000000000..7cbca6ac278a --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/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 ._avs_client import AVSClient +__all__ = ['AVSClient'] diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_avs_client.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_avs_client.py new file mode 100644 index 000000000000..f1bfa9858a3e --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_avs_client.py @@ -0,0 +1,147 @@ +# 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.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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 AVSClientConfiguration +from .operations import Operations +from .operations import LocationsOperations +from .operations import PrivateCloudsOperations +from .operations import ClustersOperations +from .operations import DatastoresOperations +from .operations import HcxEnterpriseSitesOperations +from .operations import AuthorizationsOperations +from .operations import GlobalReachConnectionsOperations +from .operations import WorkloadNetworksOperations +from .operations import CloudLinksOperations +from .operations import AddonsOperations +from .operations import ScriptPackagesOperations +from .operations import ScriptCmdletsOperations +from .operations import ScriptExecutionsOperations +from .. import models + + +class AVSClient(object): + """Azure VMware Solution API. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.avs.aio.operations.Operations + :ivar locations: LocationsOperations operations + :vartype locations: azure.mgmt.avs.aio.operations.LocationsOperations + :ivar private_clouds: PrivateCloudsOperations operations + :vartype private_clouds: azure.mgmt.avs.aio.operations.PrivateCloudsOperations + :ivar clusters: ClustersOperations operations + :vartype clusters: azure.mgmt.avs.aio.operations.ClustersOperations + :ivar datastores: DatastoresOperations operations + :vartype datastores: azure.mgmt.avs.aio.operations.DatastoresOperations + :ivar hcx_enterprise_sites: HcxEnterpriseSitesOperations operations + :vartype hcx_enterprise_sites: azure.mgmt.avs.aio.operations.HcxEnterpriseSitesOperations + :ivar authorizations: AuthorizationsOperations operations + :vartype authorizations: azure.mgmt.avs.aio.operations.AuthorizationsOperations + :ivar global_reach_connections: GlobalReachConnectionsOperations operations + :vartype global_reach_connections: azure.mgmt.avs.aio.operations.GlobalReachConnectionsOperations + :ivar workload_networks: WorkloadNetworksOperations operations + :vartype workload_networks: azure.mgmt.avs.aio.operations.WorkloadNetworksOperations + :ivar cloud_links: CloudLinksOperations operations + :vartype cloud_links: azure.mgmt.avs.aio.operations.CloudLinksOperations + :ivar addons: AddonsOperations operations + :vartype addons: azure.mgmt.avs.aio.operations.AddonsOperations + :ivar script_packages: ScriptPackagesOperations operations + :vartype script_packages: azure.mgmt.avs.aio.operations.ScriptPackagesOperations + :ivar script_cmdlets: ScriptCmdletsOperations operations + :vartype script_cmdlets: azure.mgmt.avs.aio.operations.ScriptCmdletsOperations + :ivar script_executions: ScriptExecutionsOperations operations + :vartype script_executions: azure.mgmt.avs.aio.operations.ScriptExecutionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :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 = AVSClientConfiguration(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._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.locations = LocationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_clouds = PrivateCloudsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.clusters = ClustersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.datastores = DatastoresOperations( + self._client, self._config, self._serialize, self._deserialize) + self.hcx_enterprise_sites = HcxEnterpriseSitesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.authorizations = AuthorizationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.global_reach_connections = GlobalReachConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.workload_networks = WorkloadNetworksOperations( + self._client, self._config, self._serialize, self._deserialize) + self.cloud_links = CloudLinksOperations( + self._client, self._config, self._serialize, self._deserialize) + self.addons = AddonsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.script_packages = ScriptPackagesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.script_cmdlets = ScriptCmdletsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.script_executions = ScriptExecutionsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AVSClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_configuration.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_configuration.py new file mode 100644 index 000000000000..09d731cb67d0 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/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 AVSClientConfiguration(Configuration): + """Configuration for AVSClient. + + 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: The ID of the target subscription. + :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(AVSClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-06-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-avs/{}'.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/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/__init__.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/__init__.py new file mode 100644 index 000000000000..1e3c208eb0fd --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/__init__.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._locations_operations import LocationsOperations +from ._private_clouds_operations import PrivateCloudsOperations +from ._clusters_operations import ClustersOperations +from ._datastores_operations import DatastoresOperations +from ._hcx_enterprise_sites_operations import HcxEnterpriseSitesOperations +from ._authorizations_operations import AuthorizationsOperations +from ._global_reach_connections_operations import GlobalReachConnectionsOperations +from ._workload_networks_operations import WorkloadNetworksOperations +from ._cloud_links_operations import CloudLinksOperations +from ._addons_operations import AddonsOperations +from ._script_packages_operations import ScriptPackagesOperations +from ._script_cmdlets_operations import ScriptCmdletsOperations +from ._script_executions_operations import ScriptExecutionsOperations + +__all__ = [ + 'Operations', + 'LocationsOperations', + 'PrivateCloudsOperations', + 'ClustersOperations', + 'DatastoresOperations', + 'HcxEnterpriseSitesOperations', + 'AuthorizationsOperations', + 'GlobalReachConnectionsOperations', + 'WorkloadNetworksOperations', + 'CloudLinksOperations', + 'AddonsOperations', + 'ScriptPackagesOperations', + 'ScriptCmdletsOperations', + 'ScriptExecutionsOperations', +] diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_addons_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_addons_operations.py new file mode 100644 index 000000000000..b3eaa90e1d57 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_addons_operations.py @@ -0,0 +1,438 @@ +# 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 AddonsOperations: + """AddonsOperations 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.avs.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 + + def list( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AddonList"]: + """List addons in a private cloud. + + List addons in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AddonList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.AddonList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AddonList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('AddonList', 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.AVS/privateClouds/{privateCloudName}/addons'} # type: ignore + + async def get( + self, + resource_group_name: str, + private_cloud_name: str, + addon_name: str, + **kwargs: Any + ) -> "_models.Addon": + """Get an addon by name in a private cloud. + + Get an addon by name in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param addon_name: Name of the addon for the private cloud. + :type addon_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Addon, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.Addon + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'addonName': self._serialize.url("addon_name", addon_name, '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('Addon', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + private_cloud_name: str, + addon_name: str, + addon: "_models.Addon", + **kwargs: Any + ) -> "_models.Addon": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'addonName': self._serialize.url("addon_name", addon_name, '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['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(addon, 'Addon') + 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('Addon', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Addon', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + private_cloud_name: str, + addon_name: str, + addon: "_models.Addon", + **kwargs: Any + ) -> AsyncLROPoller["_models.Addon"]: + """Create or update a addon in a private cloud. + + Create or update a addon in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: The name of the private cloud. + :type private_cloud_name: str + :param addon_name: Name of the addon for the private cloud. + :type addon_name: str + :param addon: A addon in the private cloud. + :type addon: ~azure.mgmt.avs.models.Addon + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Addon or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Addon] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] + 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_cloud_name=private_cloud_name, + addon_name=addon_name, + addon=addon, + 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('Addon', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'addonName': self._serialize.url("addon_name", addon_name, '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.AVS/privateClouds/{privateCloudName}/addons/{addonName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + private_cloud_name: str, + addon_name: str, + **kwargs: Any + ) -> 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'addonName': self._serialize.url("addon_name", addon_name, '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.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.AVS/privateClouds/{privateCloudName}/addons/{addonName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + private_cloud_name: str, + addon_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a addon in a private cloud. + + Delete a addon in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param addon_name: Name of the addon for the private cloud. + :type addon_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_cloud_name=private_cloud_name, + addon_name=addon_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'addonName': self._serialize.url("addon_name", addon_name, '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.AVS/privateClouds/{privateCloudName}/addons/{addonName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_authorizations_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_authorizations_operations.py new file mode 100644 index 000000000000..311015cbd555 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_authorizations_operations.py @@ -0,0 +1,438 @@ +# 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 AuthorizationsOperations: + """AuthorizationsOperations 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.avs.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 + + def list( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ExpressRouteAuthorizationList"]: + """List ExpressRoute Circuit Authorizations in a private cloud. + + List ExpressRoute Circuit Authorizations in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRouteAuthorizationList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.ExpressRouteAuthorizationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExpressRouteAuthorizationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('ExpressRouteAuthorizationList', 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.AVS/privateClouds/{privateCloudName}/authorizations'} # type: ignore + + async def get( + self, + resource_group_name: str, + private_cloud_name: str, + authorization_name: str, + **kwargs: Any + ) -> "_models.ExpressRouteAuthorization": + """Get an ExpressRoute Circuit Authorization by name in a private cloud. + + Get an ExpressRoute Circuit Authorization by name in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud. + :type authorization_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteAuthorization, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.ExpressRouteAuthorization + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExpressRouteAuthorization"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'authorizationName': self._serialize.url("authorization_name", authorization_name, '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('ExpressRouteAuthorization', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + private_cloud_name: str, + authorization_name: str, + authorization: "_models.ExpressRouteAuthorization", + **kwargs: Any + ) -> "_models.ExpressRouteAuthorization": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExpressRouteAuthorization"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'authorizationName': self._serialize.url("authorization_name", authorization_name, '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['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(authorization, 'ExpressRouteAuthorization') + 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('ExpressRouteAuthorization', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteAuthorization', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + private_cloud_name: str, + authorization_name: str, + authorization: "_models.ExpressRouteAuthorization", + **kwargs: Any + ) -> AsyncLROPoller["_models.ExpressRouteAuthorization"]: + """Create or update an ExpressRoute Circuit Authorization in a private cloud. + + Create or update an ExpressRoute Circuit Authorization in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: The name of the private cloud. + :type private_cloud_name: str + :param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud. + :type authorization_name: str + :param authorization: An ExpressRoute Circuit Authorization. + :type authorization: ~azure.mgmt.avs.models.ExpressRouteAuthorization + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExpressRouteAuthorization or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExpressRouteAuthorization"] + 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_cloud_name=private_cloud_name, + authorization_name=authorization_name, + authorization=authorization, + 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('ExpressRouteAuthorization', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'authorizationName': self._serialize.url("authorization_name", authorization_name, '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.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + private_cloud_name: str, + authorization_name: str, + **kwargs: Any + ) -> 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'authorizationName': self._serialize.url("authorization_name", authorization_name, '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.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.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + private_cloud_name: str, + authorization_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete an ExpressRoute Circuit Authorization in a private cloud. + + Delete an ExpressRoute Circuit Authorization in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud. + :type authorization_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_cloud_name=private_cloud_name, + authorization_name=authorization_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'authorizationName': self._serialize.url("authorization_name", authorization_name, '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.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_cloud_links_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_cloud_links_operations.py new file mode 100644 index 000000000000..0d2f8e306586 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_cloud_links_operations.py @@ -0,0 +1,438 @@ +# 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 CloudLinksOperations: + """CloudLinksOperations 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.avs.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 + + def list( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.CloudLinkList"]: + """List cloud link in a private cloud. + + List cloud link in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CloudLinkList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.CloudLinkList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudLinkList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('CloudLinkList', 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.AVS/privateClouds/{privateCloudName}/cloudLinks'} # type: ignore + + async def get( + self, + resource_group_name: str, + private_cloud_name: str, + cloud_link_name: str, + **kwargs: Any + ) -> "_models.CloudLink": + """Get an cloud link by name in a private cloud. + + Get an cloud link by name in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param cloud_link_name: Name of the cloud link resource. + :type cloud_link_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CloudLink, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.CloudLink + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudLink"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'cloudLinkName': self._serialize.url("cloud_link_name", cloud_link_name, '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('CloudLink', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + private_cloud_name: str, + cloud_link_name: str, + cloud_link: "_models.CloudLink", + **kwargs: Any + ) -> "_models.CloudLink": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudLink"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'cloudLinkName': self._serialize.url("cloud_link_name", cloud_link_name, '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['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(cloud_link, 'CloudLink') + 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('CloudLink', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CloudLink', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + private_cloud_name: str, + cloud_link_name: str, + cloud_link: "_models.CloudLink", + **kwargs: Any + ) -> AsyncLROPoller["_models.CloudLink"]: + """Create or update a cloud link in a private cloud. + + Create or update a cloud link in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: The name of the private cloud. + :type private_cloud_name: str + :param cloud_link_name: Name of the cloud link resource. + :type cloud_link_name: str + :param cloud_link: A cloud link in the private cloud. + :type cloud_link: ~azure.mgmt.avs.models.CloudLink + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CloudLink or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.CloudLink] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudLink"] + 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_cloud_name=private_cloud_name, + cloud_link_name=cloud_link_name, + cloud_link=cloud_link, + 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('CloudLink', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'cloudLinkName': self._serialize.url("cloud_link_name", cloud_link_name, '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.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + private_cloud_name: str, + cloud_link_name: str, + **kwargs: Any + ) -> 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'cloudLinkName': self._serialize.url("cloud_link_name", cloud_link_name, '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.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.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + private_cloud_name: str, + cloud_link_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a cloud link in a private cloud. + + Delete a cloud link in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param cloud_link_name: Name of the cloud link resource. + :type cloud_link_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_cloud_name=private_cloud_name, + cloud_link_name=cloud_link_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'cloudLinkName': self._serialize.url("cloud_link_name", cloud_link_name, '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.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_clusters_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_clusters_operations.py new file mode 100644 index 000000000000..0336fd404ecf --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_clusters_operations.py @@ -0,0 +1,575 @@ +# 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 ClustersOperations: + """ClustersOperations 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.avs.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 + + def list( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ClusterList"]: + """List clusters in a private cloud. + + List clusters in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ClusterList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.ClusterList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('ClusterList', 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.AVS/privateClouds/{privateCloudName}/clusters'} # type: ignore + + async def get( + self, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + **kwargs: Any + ) -> "_models.Cluster": + """Get a cluster by name in a private cloud. + + Get a cluster by name in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param cluster_name: Name of the cluster in the private cloud. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Cluster, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.Cluster + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, '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('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + cluster: "_models.Cluster", + **kwargs: Any + ) -> "_models.Cluster": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, '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['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(cluster, 'Cluster') + 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('Cluster', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + cluster: "_models.Cluster", + **kwargs: Any + ) -> AsyncLROPoller["_models.Cluster"]: + """Create or update a cluster in a private cloud. + + Create or update a cluster in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: The name of the private cloud. + :type private_cloud_name: str + :param cluster_name: Name of the cluster in the private cloud. + :type cluster_name: str + :param cluster: A cluster in the private cloud. + :type cluster: ~azure.mgmt.avs.models.Cluster + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Cluster or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + 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_cloud_name=private_cloud_name, + cluster_name=cluster_name, + cluster=cluster, + 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('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, '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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + cluster_update: "_models.ClusterUpdate", + **kwargs: Any + ) -> "_models.Cluster": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, '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['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(cluster_update, 'ClusterUpdate') + 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, 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('Cluster', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + cluster_update: "_models.ClusterUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.Cluster"]: + """Update a cluster in a private cloud. + + Update a cluster in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param cluster_name: Name of the cluster in the private cloud. + :type cluster_name: str + :param cluster_update: The cluster properties to be updated. + :type cluster_update: ~azure.mgmt.avs.models.ClusterUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Cluster or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + 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_cloud_name=private_cloud_name, + cluster_name=cluster_name, + cluster_update=cluster_update, + 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('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, '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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + **kwargs: Any + ) -> 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, '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.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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a cluster in a private cloud. + + Delete a cluster in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param cluster_name: Name of the cluster in the private cloud. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_cloud_name=private_cloud_name, + cluster_name=cluster_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, '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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_datastores_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_datastores_operations.py new file mode 100644 index 000000000000..1cd53a810f81 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_datastores_operations.py @@ -0,0 +1,460 @@ +# 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 DatastoresOperations: + """DatastoresOperations 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.avs.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 + + def list( + self, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.DatastoreList"]: + """List datastores in a private cloud cluster. + + List datastores in a private cloud cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param cluster_name: Name of the cluster in the private cloud. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatastoreList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.DatastoreList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatastoreList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, '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') + + 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('DatastoreList', 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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores'} # type: ignore + + async def get( + self, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + datastore_name: str, + **kwargs: Any + ) -> "_models.Datastore": + """Get a datastore in a private cloud cluster. + + Get a datastore in a private cloud cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param cluster_name: Name of the cluster in the private cloud. + :type cluster_name: str + :param datastore_name: Name of the datastore in the private cloud cluster. + :type datastore_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Datastore, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.Datastore + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Datastore"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'datastoreName': self._serialize.url("datastore_name", datastore_name, '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('Datastore', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + datastore_name: str, + datastore: "_models.Datastore", + **kwargs: Any + ) -> "_models.Datastore": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Datastore"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'datastoreName': self._serialize.url("datastore_name", datastore_name, '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['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(datastore, 'Datastore') + 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('Datastore', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Datastore', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + datastore_name: str, + datastore: "_models.Datastore", + **kwargs: Any + ) -> AsyncLROPoller["_models.Datastore"]: + """Create or update a datastore in a private cloud cluster. + + Create or update a datastore in a private cloud cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param cluster_name: Name of the cluster in the private cloud. + :type cluster_name: str + :param datastore_name: Name of the datastore in the private cloud cluster. + :type datastore_name: str + :param datastore: A datastore in a private cloud cluster. + :type datastore: ~azure.mgmt.avs.models.Datastore + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Datastore or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Datastore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Datastore"] + 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_cloud_name=private_cloud_name, + cluster_name=cluster_name, + datastore_name=datastore_name, + datastore=datastore, + 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('Datastore', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'datastoreName': self._serialize.url("datastore_name", datastore_name, '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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + datastore_name: str, + **kwargs: Any + ) -> 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'datastoreName': self._serialize.url("datastore_name", datastore_name, '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.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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + datastore_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a datastore in a private cloud cluster. + + Delete a datastore in a private cloud cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param cluster_name: Name of the cluster in the private cloud. + :type cluster_name: str + :param datastore_name: Name of the datastore in the private cloud cluster. + :type datastore_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_cloud_name=private_cloud_name, + cluster_name=cluster_name, + datastore_name=datastore_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'datastoreName': self._serialize.url("datastore_name", datastore_name, '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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_global_reach_connections_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_global_reach_connections_operations.py new file mode 100644 index 000000000000..62ce3f6e96d7 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_global_reach_connections_operations.py @@ -0,0 +1,438 @@ +# 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 GlobalReachConnectionsOperations: + """GlobalReachConnectionsOperations 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.avs.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 + + def list( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.GlobalReachConnectionList"]: + """List global reach connections in a private cloud. + + List global reach connections in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GlobalReachConnectionList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.GlobalReachConnectionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GlobalReachConnectionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('GlobalReachConnectionList', 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.AVS/privateClouds/{privateCloudName}/globalReachConnections'} # type: ignore + + async def get( + self, + resource_group_name: str, + private_cloud_name: str, + global_reach_connection_name: str, + **kwargs: Any + ) -> "_models.GlobalReachConnection": + """Get a global reach connection by name in a private cloud. + + Get a global reach connection by name in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param global_reach_connection_name: Name of the global reach connection in the private cloud. + :type global_reach_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GlobalReachConnection, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.GlobalReachConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GlobalReachConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'globalReachConnectionName': self._serialize.url("global_reach_connection_name", global_reach_connection_name, '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('GlobalReachConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + private_cloud_name: str, + global_reach_connection_name: str, + global_reach_connection: "_models.GlobalReachConnection", + **kwargs: Any + ) -> "_models.GlobalReachConnection": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GlobalReachConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'globalReachConnectionName': self._serialize.url("global_reach_connection_name", global_reach_connection_name, '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['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(global_reach_connection, 'GlobalReachConnection') + 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('GlobalReachConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GlobalReachConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + private_cloud_name: str, + global_reach_connection_name: str, + global_reach_connection: "_models.GlobalReachConnection", + **kwargs: Any + ) -> AsyncLROPoller["_models.GlobalReachConnection"]: + """Create or update a global reach connection in a private cloud. + + Create or update a global reach connection in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: The name of the private cloud. + :type private_cloud_name: str + :param global_reach_connection_name: Name of the global reach connection in the private cloud. + :type global_reach_connection_name: str + :param global_reach_connection: A global reach connection in the private cloud. + :type global_reach_connection: ~azure.mgmt.avs.models.GlobalReachConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GlobalReachConnection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.GlobalReachConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GlobalReachConnection"] + 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_cloud_name=private_cloud_name, + global_reach_connection_name=global_reach_connection_name, + global_reach_connection=global_reach_connection, + 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('GlobalReachConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'globalReachConnectionName': self._serialize.url("global_reach_connection_name", global_reach_connection_name, '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.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + private_cloud_name: str, + global_reach_connection_name: str, + **kwargs: Any + ) -> 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'globalReachConnectionName': self._serialize.url("global_reach_connection_name", global_reach_connection_name, '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.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.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + private_cloud_name: str, + global_reach_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a global reach connection in a private cloud. + + Delete a global reach connection in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param global_reach_connection_name: Name of the global reach connection in the private cloud. + :type global_reach_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_cloud_name=private_cloud_name, + global_reach_connection_name=global_reach_connection_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'globalReachConnectionName': self._serialize.url("global_reach_connection_name", global_reach_connection_name, '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.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_hcx_enterprise_sites_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_hcx_enterprise_sites_operations.py new file mode 100644 index 000000000000..6f81584264cc --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_hcx_enterprise_sites_operations.py @@ -0,0 +1,319 @@ +# 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 HcxEnterpriseSitesOperations: + """HcxEnterpriseSitesOperations 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.avs.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 + + def list( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.HcxEnterpriseSiteList"]: + """List HCX Enterprise Sites in a private cloud. + + List HCX Enterprise Sites in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HcxEnterpriseSiteList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.HcxEnterpriseSiteList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HcxEnterpriseSiteList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('HcxEnterpriseSiteList', 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.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites'} # type: ignore + + async def get( + self, + resource_group_name: str, + private_cloud_name: str, + hcx_enterprise_site_name: str, + **kwargs: Any + ) -> "_models.HcxEnterpriseSite": + """Get an HCX Enterprise Site by name in a private cloud. + + Get an HCX Enterprise Site by name in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud. + :type hcx_enterprise_site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HcxEnterpriseSite, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HcxEnterpriseSite"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'hcxEnterpriseSiteName': self._serialize.url("hcx_enterprise_site_name", hcx_enterprise_site_name, '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('HcxEnterpriseSite', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + private_cloud_name: str, + hcx_enterprise_site_name: str, + hcx_enterprise_site: "_models.HcxEnterpriseSite", + **kwargs: Any + ) -> "_models.HcxEnterpriseSite": + """Create or update an HCX Enterprise Site in a private cloud. + + Create or update an HCX Enterprise Site in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: The name of the private cloud. + :type private_cloud_name: str + :param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud. + :type hcx_enterprise_site_name: str + :param hcx_enterprise_site: The HCX Enterprise Site. + :type hcx_enterprise_site: ~azure.mgmt.avs.models.HcxEnterpriseSite + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HcxEnterpriseSite, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HcxEnterpriseSite"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'hcxEnterpriseSiteName': self._serialize.url("hcx_enterprise_site_name", hcx_enterprise_site_name, '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['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(hcx_enterprise_site, 'HcxEnterpriseSite') + 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('HcxEnterpriseSite', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('HcxEnterpriseSite', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + private_cloud_name: str, + hcx_enterprise_site_name: str, + **kwargs: Any + ) -> None: + """Delete an HCX Enterprise Site in a private cloud. + + Delete an HCX Enterprise Site in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud. + :type hcx_enterprise_site_name: 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'hcxEnterpriseSiteName': self._serialize.url("hcx_enterprise_site_name", hcx_enterprise_site_name, '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.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.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_locations_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_locations_operations.py new file mode 100644 index 000000000000..5c986b562a41 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_locations_operations.py @@ -0,0 +1,149 @@ +# 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, Callable, Dict, Generic, Optional, TypeVar +import warnings + +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 LocationsOperations: + """LocationsOperations 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.avs.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 check_trial_availability( + self, + location: str, + **kwargs: Any + ) -> "_models.Trial": + """Return trial status for subscription by region. + + :param location: Azure region. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Trial, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.Trial + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Trial"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.check_trial_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'location': self._serialize.url("location", location, '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.post(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('Trial', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_trial_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability'} # type: ignore + + async def check_quota_availability( + self, + location: str, + **kwargs: Any + ) -> "_models.Quota": + """Return quota for subscription by region. + + :param location: Azure region. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Quota, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.Quota + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Quota"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.check_quota_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'location': self._serialize.url("location", location, '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.post(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('Quota', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_quota_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_operations.py new file mode 100644 index 000000000000..145fb53b90b6 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_operations.py @@ -0,0 +1,104 @@ +# 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 +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 Operations: + """Operations 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.avs.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 + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationList"]: + """Lists all of the available operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.OperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + 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('OperationList', 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': '/providers/Microsoft.AVS/operations'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_private_clouds_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_private_clouds_operations.py new file mode 100644 index 000000000000..bae1a2dc123c --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_private_clouds_operations.py @@ -0,0 +1,894 @@ +# 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 PrivateCloudsOperations: + """PrivateCloudsOperations 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.avs.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 + + def list( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateCloudList"]: + """List private clouds in a resource group. + + List private clouds in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateCloudList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.PrivateCloudList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateCloudList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + 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') + + 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('PrivateCloudList', 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.AVS/privateClouds'} # type: ignore + + def list_in_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateCloudList"]: + """List private clouds in a subscription. + + List private clouds in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateCloudList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.PrivateCloudList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateCloudList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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_in_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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') + + 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('PrivateCloudList', 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_in_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds'} # type: ignore + + async def get( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> "_models.PrivateCloud": + """Get a private cloud. + + Get a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateCloud, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.PrivateCloud + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateCloud"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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('PrivateCloud', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + private_cloud_name: str, + private_cloud: "_models.PrivateCloud", + **kwargs: Any + ) -> "_models.PrivateCloud": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateCloud"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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['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(private_cloud, 'PrivateCloud') + 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('PrivateCloud', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateCloud', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + private_cloud_name: str, + private_cloud: "_models.PrivateCloud", + **kwargs: Any + ) -> AsyncLROPoller["_models.PrivateCloud"]: + """Create or update a private cloud. + + Create or update a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param private_cloud: The private cloud. + :type private_cloud: ~azure.mgmt.avs.models.PrivateCloud + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateCloud or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateCloud"] + 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_cloud_name=private_cloud_name, + private_cloud=private_cloud, + 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('PrivateCloud', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.AVS/privateClouds/{privateCloudName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + private_cloud_name: str, + private_cloud_update: "_models.PrivateCloudUpdate", + **kwargs: Any + ) -> "_models.PrivateCloud": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateCloud"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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['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(private_cloud_update, 'PrivateCloudUpdate') + 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, 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('PrivateCloud', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateCloud', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + private_cloud_name: str, + private_cloud_update: "_models.PrivateCloudUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.PrivateCloud"]: + """Update a private cloud. + + Update a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param private_cloud_update: The private cloud properties to be updated. + :type private_cloud_update: ~azure.mgmt.avs.models.PrivateCloudUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateCloud or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateCloud"] + 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_cloud_name=private_cloud_name, + private_cloud_update=private_cloud_update, + 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('PrivateCloud', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.AVS/privateClouds/{privateCloudName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.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.AVS/privateClouds/{privateCloudName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a private cloud. + + Delete a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_cloud_name=private_cloud_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.AVS/privateClouds/{privateCloudName}'} # type: ignore + + async def _rotate_vcenter_password_initial( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._rotate_vcenter_password_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.post(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 [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, {}) + + _rotate_vcenter_password_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword'} # type: ignore + + async def begin_rotate_vcenter_password( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Rotate the vCenter password. + + Rotate the vCenter password. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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._rotate_vcenter_password_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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_rotate_vcenter_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword'} # type: ignore + + async def _rotate_nsxt_password_initial( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._rotate_nsxt_password_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.post(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 [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, {}) + + _rotate_nsxt_password_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword'} # type: ignore + + async def begin_rotate_nsxt_password( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Rotate the NSX-T Manager password. + + Rotate the NSX-T Manager password. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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._rotate_nsxt_password_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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_rotate_nsxt_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword'} # type: ignore + + async def list_admin_credentials( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> "_models.AdminCredentials": + """List the admin credentials for the private cloud. + + List the admin credentials for the private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AdminCredentials, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.AdminCredentials + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AdminCredentials"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.list_admin_credentials.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.post(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('AdminCredentials', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_admin_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/listAdminCredentials'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_cmdlets_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_cmdlets_operations.py new file mode 100644 index 000000000000..ae5ac31e9c2e --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_cmdlets_operations.py @@ -0,0 +1,188 @@ +# 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 +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 ScriptCmdletsOperations: + """ScriptCmdletsOperations 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.avs.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 + + def list( + self, + resource_group_name: str, + private_cloud_name: str, + script_package_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ScriptCmdletsList"]: + """Return script cmdlet resources available for a private cloud to create a script execution + resource on their Private Cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param script_package_name: Name of the script package in the private cloud. + :type script_package_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScriptCmdletsList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.ScriptCmdletsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptCmdletsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'scriptPackageName': self._serialize.url("script_package_name", script_package_name, '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') + + 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('ScriptCmdletsList', 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.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets'} # type: ignore + + async def get( + self, + resource_group_name: str, + private_cloud_name: str, + script_package_name: str, + script_cmdlet_name: str, + **kwargs: Any + ) -> "_models.ScriptCmdlet": + """Return information about a script cmdlet resource in a specific package on a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param script_package_name: Name of the script package in the private cloud. + :type script_package_name: str + :param script_cmdlet_name: Name of the script cmdlet resource in the script package in the + private cloud. + :type script_cmdlet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScriptCmdlet, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.ScriptCmdlet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptCmdlet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'scriptPackageName': self._serialize.url("script_package_name", script_package_name, 'str'), + 'scriptCmdletName': self._serialize.url("script_cmdlet_name", script_cmdlet_name, '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('ScriptCmdlet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets/{scriptCmdletName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_executions_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_executions_operations.py new file mode 100644 index 000000000000..d932b084aed5 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_executions_operations.py @@ -0,0 +1,512 @@ +# 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, List, 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 ScriptExecutionsOperations: + """ScriptExecutionsOperations 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.avs.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 + + def list( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ScriptExecutionsList"]: + """Get an script execution resource by name in a private cloud. + + Get an script execution resource by name in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScriptExecutionsList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.ScriptExecutionsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptExecutionsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('ScriptExecutionsList', 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.AVS/privateClouds/{privateCloudName}/scriptExecutions'} # type: ignore + + async def get( + self, + resource_group_name: str, + private_cloud_name: str, + script_execution_name: str, + **kwargs: Any + ) -> "_models.ScriptExecution": + """Get an script execution resource by name in a private cloud. + + Get an script execution resource by name in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param script_execution_name: Name of the user-invoked script execution resource. + :type script_execution_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScriptExecution, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.ScriptExecution + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptExecution"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, '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('ScriptExecution', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + private_cloud_name: str, + script_execution_name: str, + script_execution: "_models.ScriptExecution", + **kwargs: Any + ) -> "_models.ScriptExecution": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptExecution"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, '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['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(script_execution, 'ScriptExecution') + 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('ScriptExecution', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ScriptExecution', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + private_cloud_name: str, + script_execution_name: str, + script_execution: "_models.ScriptExecution", + **kwargs: Any + ) -> AsyncLROPoller["_models.ScriptExecution"]: + """Create or update a script execution resource in a private cloud. + + Create or update a script execution resource in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: The name of the private cloud. + :type private_cloud_name: str + :param script_execution_name: Name of the user-invoked script execution resource. + :type script_execution_name: str + :param script_execution: A script running in the private cloud. + :type script_execution: ~azure.mgmt.avs.models.ScriptExecution + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ScriptExecution or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ScriptExecution] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptExecution"] + 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_cloud_name=private_cloud_name, + script_execution_name=script_execution_name, + script_execution=script_execution, + 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('ScriptExecution', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, '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.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + private_cloud_name: str, + script_execution_name: str, + **kwargs: Any + ) -> 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, '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.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.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + private_cloud_name: str, + script_execution_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Cancel a ScriptExecution in a private cloud. + + Cancel a ScriptExecution in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param script_execution_name: Name of the user-invoked script execution resource. + :type script_execution_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_cloud_name=private_cloud_name, + script_execution_name=script_execution_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, '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.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}'} # type: ignore + + async def get_execution_logs( + self, + resource_group_name: str, + private_cloud_name: str, + script_execution_name: str, + script_output_stream_type: Optional[List[Union[str, "_models.ScriptOutputStreamType"]]] = None, + **kwargs: Any + ) -> "_models.ScriptExecution": + """Return the logs for a script execution resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param script_execution_name: Name of the user-invoked script execution resource. + :type script_execution_name: str + :param script_output_stream_type: Name of the desired output stream to return. If not provided, + will return all. An empty array will return nothing. + :type script_output_stream_type: list[str or ~azure.mgmt.avs.models.ScriptOutputStreamType] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScriptExecution, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.ScriptExecution + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptExecution"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.get_execution_logs.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, '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['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] + if script_output_stream_type is not None: + body_content = self._serialize.body(script_output_stream_type, '[str]') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(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('ScriptExecution', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_execution_logs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}/getExecutionLogs'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_packages_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_packages_operations.py new file mode 100644 index 000000000000..899811dc9ab0 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_packages_operations.py @@ -0,0 +1,178 @@ +# 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 +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 ScriptPackagesOperations: + """ScriptPackagesOperations 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.avs.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 + + def list( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ScriptPackagesList"]: + """Return script packages available for a private cloud to run on their Private Cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScriptPackagesList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.ScriptPackagesList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptPackagesList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('ScriptPackagesList', 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.AVS/privateClouds/{privateCloudName}/scriptPackages'} # type: ignore + + async def get( + self, + resource_group_name: str, + private_cloud_name: str, + script_package_name: str, + **kwargs: Any + ) -> "_models.ScriptPackage": + """Return script package available to run on an Private Cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param script_package_name: Name of the script package in the private cloud. + :type script_package_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScriptPackage, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.ScriptPackage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptPackage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'scriptPackageName': self._serialize.url("script_package_name", script_package_name, '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('ScriptPackage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_workload_networks_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_workload_networks_operations.py new file mode 100644 index 000000000000..72af28577588 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_workload_networks_operations.py @@ -0,0 +1,3903 @@ +# 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 WorkloadNetworksOperations: + """WorkloadNetworksOperations 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.avs.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 + + def list_segments( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.WorkloadNetworkSegmentsList"]: + """List of segments in a private cloud workload network. + + List of segments in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkloadNetworkSegmentsList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkSegmentsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkSegmentsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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_segments.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('WorkloadNetworkSegmentsList', 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_segments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments'} # type: ignore + + async def get_segment( + self, + resource_group_name: str, + private_cloud_name: str, + segment_id: str, + **kwargs: Any + ) -> "_models.WorkloadNetworkSegment": + """Get a segment by id in a private cloud workload network. + + Get a segment by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. + :type segment_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkloadNetworkSegment, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkSegment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkSegment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get_segment.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'segmentId': self._serialize.url("segment_id", segment_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('WorkloadNetworkSegment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_segment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + + async def _create_segments_initial( + self, + resource_group_name: str, + private_cloud_name: str, + segment_id: str, + workload_network_segment: "_models.WorkloadNetworkSegment", + **kwargs: Any + ) -> "_models.WorkloadNetworkSegment": + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkSegment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_segments_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'segmentId': self._serialize.url("segment_id", segment_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['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(workload_network_segment, 'WorkloadNetworkSegment') + 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('WorkloadNetworkSegment', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WorkloadNetworkSegment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_segments_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + + async def begin_create_segments( + self, + resource_group_name: str, + private_cloud_name: str, + segment_id: str, + workload_network_segment: "_models.WorkloadNetworkSegment", + **kwargs: Any + ) -> AsyncLROPoller["_models.WorkloadNetworkSegment"]: + """Create a segment by id in a private cloud workload network. + + Create a segment by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. + :type segment_id: str + :param workload_network_segment: NSX Segment. + :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkSegment"] + 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_segments_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + segment_id=segment_id, + workload_network_segment=workload_network_segment, + 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('WorkloadNetworkSegment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'segmentId': self._serialize.url("segment_id", segment_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_segments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + + async def _update_segments_initial( + self, + resource_group_name: str, + private_cloud_name: str, + segment_id: str, + workload_network_segment: "_models.WorkloadNetworkSegment", + **kwargs: Any + ) -> Optional["_models.WorkloadNetworkSegment"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WorkloadNetworkSegment"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_segments_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'segmentId': self._serialize.url("segment_id", segment_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['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(workload_network_segment, 'WorkloadNetworkSegment') + 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('WorkloadNetworkSegment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_segments_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + + async def begin_update_segments( + self, + resource_group_name: str, + private_cloud_name: str, + segment_id: str, + workload_network_segment: "_models.WorkloadNetworkSegment", + **kwargs: Any + ) -> AsyncLROPoller["_models.WorkloadNetworkSegment"]: + """Create or update a segment by id in a private cloud workload network. + + Create or update a segment by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. + :type segment_id: str + :param workload_network_segment: NSX Segment. + :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkSegment"] + 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_segments_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + segment_id=segment_id, + workload_network_segment=workload_network_segment, + 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('WorkloadNetworkSegment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'segmentId': self._serialize.url("segment_id", segment_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_segments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + + async def _delete_segment_initial( + self, + resource_group_name: str, + private_cloud_name: str, + segment_id: str, + **kwargs: Any + ) -> 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_segment_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'segmentId': self._serialize.url("segment_id", segment_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.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_segment_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + + async def begin_delete_segment( + self, + resource_group_name: str, + private_cloud_name: str, + segment_id: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a segment by id in a private cloud workload network. + + Delete a segment by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. + :type segment_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_segment_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + segment_id=segment_id, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'segmentId': self._serialize.url("segment_id", segment_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_segment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + + def list_dhcp( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.WorkloadNetworkDhcpList"]: + """List dhcp in a private cloud workload network. + + List dhcp in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkloadNetworkDhcpList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDhcpList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDhcpList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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_dhcp.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('WorkloadNetworkDhcpList', 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_dhcp.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations'} # type: ignore + + async def get_dhcp( + self, + resource_group_name: str, + dhcp_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> "_models.WorkloadNetworkDhcp": + """Get dhcp by id in a private cloud workload network. + + Get dhcp by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. + :type dhcp_id: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkloadNetworkDhcp, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkDhcp + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDhcp"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get_dhcp.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dhcpId': self._serialize.url("dhcp_id", dhcp_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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('WorkloadNetworkDhcp', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_dhcp.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + + async def _create_dhcp_initial( + self, + resource_group_name: str, + private_cloud_name: str, + dhcp_id: str, + workload_network_dhcp: "_models.WorkloadNetworkDhcp", + **kwargs: Any + ) -> "_models.WorkloadNetworkDhcp": + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDhcp"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_dhcp_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dhcpId': self._serialize.url("dhcp_id", dhcp_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['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(workload_network_dhcp, 'WorkloadNetworkDhcp') + 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('WorkloadNetworkDhcp', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WorkloadNetworkDhcp', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_dhcp_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + + async def begin_create_dhcp( + self, + resource_group_name: str, + private_cloud_name: str, + dhcp_id: str, + workload_network_dhcp: "_models.WorkloadNetworkDhcp", + **kwargs: Any + ) -> AsyncLROPoller["_models.WorkloadNetworkDhcp"]: + """Create dhcp by id in a private cloud workload network. + + Create dhcp by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. + :type dhcp_id: str + :param workload_network_dhcp: NSX DHCP. + :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDhcp"] + 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_dhcp_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dhcp_id=dhcp_id, + workload_network_dhcp=workload_network_dhcp, + 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('WorkloadNetworkDhcp', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dhcpId': self._serialize.url("dhcp_id", dhcp_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_dhcp.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + + async def _update_dhcp_initial( + self, + resource_group_name: str, + private_cloud_name: str, + dhcp_id: str, + workload_network_dhcp: "_models.WorkloadNetworkDhcp", + **kwargs: Any + ) -> Optional["_models.WorkloadNetworkDhcp"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WorkloadNetworkDhcp"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_dhcp_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dhcpId': self._serialize.url("dhcp_id", dhcp_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['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(workload_network_dhcp, 'WorkloadNetworkDhcp') + 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('WorkloadNetworkDhcp', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_dhcp_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + + async def begin_update_dhcp( + self, + resource_group_name: str, + private_cloud_name: str, + dhcp_id: str, + workload_network_dhcp: "_models.WorkloadNetworkDhcp", + **kwargs: Any + ) -> AsyncLROPoller["_models.WorkloadNetworkDhcp"]: + """Create or update dhcp by id in a private cloud workload network. + + Create or update dhcp by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. + :type dhcp_id: str + :param workload_network_dhcp: NSX DHCP. + :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDhcp"] + 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_dhcp_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dhcp_id=dhcp_id, + workload_network_dhcp=workload_network_dhcp, + 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('WorkloadNetworkDhcp', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dhcpId': self._serialize.url("dhcp_id", dhcp_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_dhcp.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + + async def _delete_dhcp_initial( + self, + resource_group_name: str, + private_cloud_name: str, + dhcp_id: str, + **kwargs: Any + ) -> 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_dhcp_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dhcpId': self._serialize.url("dhcp_id", dhcp_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.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_dhcp_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + + async def begin_delete_dhcp( + self, + resource_group_name: str, + private_cloud_name: str, + dhcp_id: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete dhcp by id in a private cloud workload network. + + Delete dhcp by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. + :type dhcp_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_dhcp_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dhcp_id=dhcp_id, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dhcpId': self._serialize.url("dhcp_id", dhcp_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_dhcp.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + + def list_gateways( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.WorkloadNetworkGatewayList"]: + """List of gateways in a private cloud workload network. + + List of gateways in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkloadNetworkGatewayList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkGatewayList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkGatewayList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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_gateways.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('WorkloadNetworkGatewayList', 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_gateways.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways'} # type: ignore + + async def get_gateway( + self, + resource_group_name: str, + private_cloud_name: str, + gateway_id: str, + **kwargs: Any + ) -> "_models.WorkloadNetworkGateway": + """Get a gateway by id in a private cloud workload network. + + Get a gateway by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param gateway_id: NSX Gateway identifier. Generally the same as the Gateway's display name. + :type gateway_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkloadNetworkGateway, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkGateway + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkGateway"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get_gateway.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'gatewayId': self._serialize.url("gateway_id", gateway_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('WorkloadNetworkGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId}'} # type: ignore + + def list_port_mirroring( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.WorkloadNetworkPortMirroringList"]: + """List of port mirroring profiles in a private cloud workload network. + + List of port mirroring profiles in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkloadNetworkPortMirroringList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPortMirroringList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPortMirroringList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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_port_mirroring.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('WorkloadNetworkPortMirroringList', 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_port_mirroring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles'} # type: ignore + + async def get_port_mirroring( + self, + resource_group_name: str, + private_cloud_name: str, + port_mirroring_id: str, + **kwargs: Any + ) -> "_models.WorkloadNetworkPortMirroring": + """Get a port mirroring profile by id in a private cloud workload network. + + Get a port mirroring profile by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port + Mirroring display name. + :type port_mirroring_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkloadNetworkPortMirroring, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPortMirroring"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get_port_mirroring.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_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('WorkloadNetworkPortMirroring', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_port_mirroring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + + async def _create_port_mirroring_initial( + self, + resource_group_name: str, + private_cloud_name: str, + port_mirroring_id: str, + workload_network_port_mirroring: "_models.WorkloadNetworkPortMirroring", + **kwargs: Any + ) -> "_models.WorkloadNetworkPortMirroring": + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPortMirroring"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_port_mirroring_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_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['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(workload_network_port_mirroring, 'WorkloadNetworkPortMirroring') + 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('WorkloadNetworkPortMirroring', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WorkloadNetworkPortMirroring', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_port_mirroring_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + + async def begin_create_port_mirroring( + self, + resource_group_name: str, + private_cloud_name: str, + port_mirroring_id: str, + workload_network_port_mirroring: "_models.WorkloadNetworkPortMirroring", + **kwargs: Any + ) -> AsyncLROPoller["_models.WorkloadNetworkPortMirroring"]: + """Create a port mirroring profile by id in a private cloud workload network. + + Create a port mirroring profile by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port + Mirroring display name. + :type port_mirroring_id: str + :param workload_network_port_mirroring: NSX port mirroring. + :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPortMirroring"] + 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_port_mirroring_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + port_mirroring_id=port_mirroring_id, + workload_network_port_mirroring=workload_network_port_mirroring, + 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('WorkloadNetworkPortMirroring', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_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_port_mirroring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + + async def _update_port_mirroring_initial( + self, + resource_group_name: str, + private_cloud_name: str, + port_mirroring_id: str, + workload_network_port_mirroring: "_models.WorkloadNetworkPortMirroring", + **kwargs: Any + ) -> Optional["_models.WorkloadNetworkPortMirroring"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WorkloadNetworkPortMirroring"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_port_mirroring_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_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['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(workload_network_port_mirroring, 'WorkloadNetworkPortMirroring') + 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('WorkloadNetworkPortMirroring', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_port_mirroring_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + + async def begin_update_port_mirroring( + self, + resource_group_name: str, + private_cloud_name: str, + port_mirroring_id: str, + workload_network_port_mirroring: "_models.WorkloadNetworkPortMirroring", + **kwargs: Any + ) -> AsyncLROPoller["_models.WorkloadNetworkPortMirroring"]: + """Create or update a port mirroring profile by id in a private cloud workload network. + + Create or update a port mirroring profile by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port + Mirroring display name. + :type port_mirroring_id: str + :param workload_network_port_mirroring: NSX port mirroring. + :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPortMirroring"] + 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_port_mirroring_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + port_mirroring_id=port_mirroring_id, + workload_network_port_mirroring=workload_network_port_mirroring, + 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('WorkloadNetworkPortMirroring', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_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_port_mirroring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + + async def _delete_port_mirroring_initial( + self, + resource_group_name: str, + port_mirroring_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_port_mirroring_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.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_port_mirroring_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + + async def begin_delete_port_mirroring( + self, + resource_group_name: str, + port_mirroring_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a port mirroring profile by id in a private cloud workload network. + + Delete a port mirroring profile by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port + Mirroring display name. + :type port_mirroring_id: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_port_mirroring_initial( + resource_group_name=resource_group_name, + port_mirroring_id=port_mirroring_id, + private_cloud_name=private_cloud_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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_port_mirroring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + + def list_vm_groups( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.WorkloadNetworkVMGroupsList"]: + """List of vm groups in a private cloud workload network. + + List of vm groups in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkloadNetworkVMGroupsList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVMGroupsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVMGroupsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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_vm_groups.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('WorkloadNetworkVMGroupsList', 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_vm_groups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups'} # type: ignore + + async def get_vm_group( + self, + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + **kwargs: Any + ) -> "_models.WorkloadNetworkVMGroup": + """Get a vm group by id in a private cloud workload network. + + Get a vm group by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. + :type vm_group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkloadNetworkVMGroup, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVMGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get_vm_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'vmGroupId': self._serialize.url("vm_group_id", vm_group_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('WorkloadNetworkVMGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vm_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + + async def _create_vm_group_initial( + self, + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + workload_network_vm_group: "_models.WorkloadNetworkVMGroup", + **kwargs: Any + ) -> "_models.WorkloadNetworkVMGroup": + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVMGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_vm_group_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'vmGroupId': self._serialize.url("vm_group_id", vm_group_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['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(workload_network_vm_group, 'WorkloadNetworkVMGroup') + 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('WorkloadNetworkVMGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WorkloadNetworkVMGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_vm_group_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + + async def begin_create_vm_group( + self, + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + workload_network_vm_group: "_models.WorkloadNetworkVMGroup", + **kwargs: Any + ) -> AsyncLROPoller["_models.WorkloadNetworkVMGroup"]: + """Create a vm group by id in a private cloud workload network. + + Create a vm group by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. + :type vm_group_id: str + :param workload_network_vm_group: NSX VM Group. + :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVMGroup"] + 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_vm_group_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + vm_group_id=vm_group_id, + workload_network_vm_group=workload_network_vm_group, + 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('WorkloadNetworkVMGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'vmGroupId': self._serialize.url("vm_group_id", vm_group_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_vm_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + + async def _update_vm_group_initial( + self, + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + workload_network_vm_group: "_models.WorkloadNetworkVMGroup", + **kwargs: Any + ) -> Optional["_models.WorkloadNetworkVMGroup"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WorkloadNetworkVMGroup"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_vm_group_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'vmGroupId': self._serialize.url("vm_group_id", vm_group_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['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(workload_network_vm_group, 'WorkloadNetworkVMGroup') + 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('WorkloadNetworkVMGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_vm_group_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + + async def begin_update_vm_group( + self, + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + workload_network_vm_group: "_models.WorkloadNetworkVMGroup", + **kwargs: Any + ) -> AsyncLROPoller["_models.WorkloadNetworkVMGroup"]: + """Create or update a vm group by id in a private cloud workload network. + + Create or update a vm group by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. + :type vm_group_id: str + :param workload_network_vm_group: NSX VM Group. + :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVMGroup"] + 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_vm_group_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + vm_group_id=vm_group_id, + workload_network_vm_group=workload_network_vm_group, + 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('WorkloadNetworkVMGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'vmGroupId': self._serialize.url("vm_group_id", vm_group_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_vm_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + + async def _delete_vm_group_initial( + self, + resource_group_name: str, + vm_group_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_vm_group_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'vmGroupId': self._serialize.url("vm_group_id", vm_group_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.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_vm_group_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + + async def begin_delete_vm_group( + self, + resource_group_name: str, + vm_group_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a vm group by id in a private cloud workload network. + + Delete a vm group by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. + :type vm_group_id: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_vm_group_initial( + resource_group_name=resource_group_name, + vm_group_id=vm_group_id, + private_cloud_name=private_cloud_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'vmGroupId': self._serialize.url("vm_group_id", vm_group_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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_vm_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + + def list_virtual_machines( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.WorkloadNetworkVirtualMachinesList"]: + """List of virtual machines in a private cloud workload network. + + List of virtual machines in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkloadNetworkVirtualMachinesList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVirtualMachinesList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVirtualMachinesList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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_virtual_machines.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('WorkloadNetworkVirtualMachinesList', 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_virtual_machines.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines'} # type: ignore + + async def get_virtual_machine( + self, + resource_group_name: str, + private_cloud_name: str, + virtual_machine_id: str, + **kwargs: Any + ) -> "_models.WorkloadNetworkVirtualMachine": + """Get a virtual machine by id in a private cloud workload network. + + Get a virtual machine by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param virtual_machine_id: Virtual Machine identifier. + :type virtual_machine_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkloadNetworkVirtualMachine, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVirtualMachine"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get_virtual_machine.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'virtualMachineId': self._serialize.url("virtual_machine_id", virtual_machine_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('WorkloadNetworkVirtualMachine', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_virtual_machine.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId}'} # type: ignore + + def list_dns_services( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.WorkloadNetworkDnsServicesList"]: + """List of DNS services in a private cloud workload network. + + List of DNS services in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkloadNetworkDnsServicesList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsServicesList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsServicesList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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_dns_services.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('WorkloadNetworkDnsServicesList', 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_dns_services.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices'} # type: ignore + + async def get_dns_service( + self, + resource_group_name: str, + private_cloud_name: str, + dns_service_id: str, + **kwargs: Any + ) -> "_models.WorkloadNetworkDnsService": + """Get a DNS service by id in a private cloud workload network. + + Get a DNS service by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's + display name. + :type dns_service_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkloadNetworkDnsService, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkDnsService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get_dns_service.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_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('WorkloadNetworkDnsService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_dns_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + + async def _create_dns_service_initial( + self, + resource_group_name: str, + private_cloud_name: str, + dns_service_id: str, + workload_network_dns_service: "_models.WorkloadNetworkDnsService", + **kwargs: Any + ) -> "_models.WorkloadNetworkDnsService": + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_dns_service_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_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['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(workload_network_dns_service, 'WorkloadNetworkDnsService') + 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('WorkloadNetworkDnsService', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WorkloadNetworkDnsService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_dns_service_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + + async def begin_create_dns_service( + self, + resource_group_name: str, + private_cloud_name: str, + dns_service_id: str, + workload_network_dns_service: "_models.WorkloadNetworkDnsService", + **kwargs: Any + ) -> AsyncLROPoller["_models.WorkloadNetworkDnsService"]: + """Create a DNS service by id in a private cloud workload network. + + Create a DNS service by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's + display name. + :type dns_service_id: str + :param workload_network_dns_service: NSX DNS Service. + :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsService"] + 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_dns_service_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_service_id=dns_service_id, + workload_network_dns_service=workload_network_dns_service, + 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('WorkloadNetworkDnsService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_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_dns_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + + async def _update_dns_service_initial( + self, + resource_group_name: str, + private_cloud_name: str, + dns_service_id: str, + workload_network_dns_service: "_models.WorkloadNetworkDnsService", + **kwargs: Any + ) -> Optional["_models.WorkloadNetworkDnsService"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WorkloadNetworkDnsService"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_dns_service_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_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['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(workload_network_dns_service, 'WorkloadNetworkDnsService') + 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('WorkloadNetworkDnsService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_dns_service_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + + async def begin_update_dns_service( + self, + resource_group_name: str, + private_cloud_name: str, + dns_service_id: str, + workload_network_dns_service: "_models.WorkloadNetworkDnsService", + **kwargs: Any + ) -> AsyncLROPoller["_models.WorkloadNetworkDnsService"]: + """Create or update a DNS service by id in a private cloud workload network. + + Create or update a DNS service by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's + display name. + :type dns_service_id: str + :param workload_network_dns_service: NSX DNS Service. + :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsService"] + 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_dns_service_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_service_id=dns_service_id, + workload_network_dns_service=workload_network_dns_service, + 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('WorkloadNetworkDnsService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_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_dns_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + + async def _delete_dns_service_initial( + self, + resource_group_name: str, + dns_service_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_dns_service_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.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_dns_service_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + + async def begin_delete_dns_service( + self, + resource_group_name: str, + dns_service_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a DNS service by id in a private cloud workload network. + + Delete a DNS service by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's + display name. + :type dns_service_id: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_dns_service_initial( + resource_group_name=resource_group_name, + dns_service_id=dns_service_id, + private_cloud_name=private_cloud_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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_dns_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + + def list_dns_zones( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.WorkloadNetworkDnsZonesList"]: + """List of DNS zones in a private cloud workload network. + + List of DNS zones in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkloadNetworkDnsZonesList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsZonesList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsZonesList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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_dns_zones.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('WorkloadNetworkDnsZonesList', 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_dns_zones.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones'} # type: ignore + + async def get_dns_zone( + self, + resource_group_name: str, + private_cloud_name: str, + dns_zone_id: str, + **kwargs: Any + ) -> "_models.WorkloadNetworkDnsZone": + """Get a DNS zone by id in a private cloud workload network. + + Get a DNS zone by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + :type dns_zone_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkloadNetworkDnsZone, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsZone"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get_dns_zone.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_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('WorkloadNetworkDnsZone', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_dns_zone.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + + async def _create_dns_zone_initial( + self, + resource_group_name: str, + private_cloud_name: str, + dns_zone_id: str, + workload_network_dns_zone: "_models.WorkloadNetworkDnsZone", + **kwargs: Any + ) -> "_models.WorkloadNetworkDnsZone": + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsZone"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_dns_zone_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_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['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(workload_network_dns_zone, 'WorkloadNetworkDnsZone') + 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('WorkloadNetworkDnsZone', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WorkloadNetworkDnsZone', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_dns_zone_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + + async def begin_create_dns_zone( + self, + resource_group_name: str, + private_cloud_name: str, + dns_zone_id: str, + workload_network_dns_zone: "_models.WorkloadNetworkDnsZone", + **kwargs: Any + ) -> AsyncLROPoller["_models.WorkloadNetworkDnsZone"]: + """Create a DNS zone by id in a private cloud workload network. + + Create a DNS zone by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + :type dns_zone_id: str + :param workload_network_dns_zone: NSX DNS Zone. + :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsZone"] + 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_dns_zone_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_zone_id=dns_zone_id, + workload_network_dns_zone=workload_network_dns_zone, + 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('WorkloadNetworkDnsZone', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_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_dns_zone.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + + async def _update_dns_zone_initial( + self, + resource_group_name: str, + private_cloud_name: str, + dns_zone_id: str, + workload_network_dns_zone: "_models.WorkloadNetworkDnsZone", + **kwargs: Any + ) -> Optional["_models.WorkloadNetworkDnsZone"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WorkloadNetworkDnsZone"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_dns_zone_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_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['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(workload_network_dns_zone, 'WorkloadNetworkDnsZone') + 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('WorkloadNetworkDnsZone', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_dns_zone_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + + async def begin_update_dns_zone( + self, + resource_group_name: str, + private_cloud_name: str, + dns_zone_id: str, + workload_network_dns_zone: "_models.WorkloadNetworkDnsZone", + **kwargs: Any + ) -> AsyncLROPoller["_models.WorkloadNetworkDnsZone"]: + """Create or update a DNS zone by id in a private cloud workload network. + + Create or update a DNS zone by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + :type dns_zone_id: str + :param workload_network_dns_zone: NSX DNS Zone. + :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsZone"] + 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_dns_zone_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_zone_id=dns_zone_id, + workload_network_dns_zone=workload_network_dns_zone, + 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('WorkloadNetworkDnsZone', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_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_dns_zone.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + + async def _delete_dns_zone_initial( + self, + resource_group_name: str, + dns_zone_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_dns_zone_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.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_dns_zone_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + + async def begin_delete_dns_zone( + self, + resource_group_name: str, + dns_zone_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a DNS zone by id in a private cloud workload network. + + Delete a DNS zone by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + :type dns_zone_id: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_dns_zone_initial( + resource_group_name=resource_group_name, + dns_zone_id=dns_zone_id, + private_cloud_name=private_cloud_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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_dns_zone.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + + def list_public_i_ps( + self, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.WorkloadNetworkPublicIPsList"]: + """List of Public IP Blocks in a private cloud workload network. + + List of Public IP Blocks in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkloadNetworkPublicIPsList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPublicIPsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPublicIPsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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_public_i_ps.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('WorkloadNetworkPublicIPsList', 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_public_i_ps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs'} # type: ignore + + async def get_public_ip( + self, + resource_group_name: str, + private_cloud_name: str, + public_ip_id: str, + **kwargs: Any + ) -> "_models.WorkloadNetworkPublicIP": + """Get a Public IP Block by id in a private cloud workload network. + + Get a Public IP Block by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP + Block's display name. + :type public_ip_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkloadNetworkPublicIP, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPublicIP"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get_public_ip.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'publicIPId': self._serialize.url("public_ip_id", public_ip_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('WorkloadNetworkPublicIP', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_public_ip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}'} # type: ignore + + async def _create_public_ip_initial( + self, + resource_group_name: str, + private_cloud_name: str, + public_ip_id: str, + workload_network_public_ip: "_models.WorkloadNetworkPublicIP", + **kwargs: Any + ) -> "_models.WorkloadNetworkPublicIP": + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPublicIP"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_public_ip_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'publicIPId': self._serialize.url("public_ip_id", public_ip_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['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(workload_network_public_ip, 'WorkloadNetworkPublicIP') + 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('WorkloadNetworkPublicIP', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WorkloadNetworkPublicIP', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_public_ip_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}'} # type: ignore + + async def begin_create_public_ip( + self, + resource_group_name: str, + private_cloud_name: str, + public_ip_id: str, + workload_network_public_ip: "_models.WorkloadNetworkPublicIP", + **kwargs: Any + ) -> AsyncLROPoller["_models.WorkloadNetworkPublicIP"]: + """Create a Public IP Block by id in a private cloud workload network. + + Create a Public IP Block by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP + Block's display name. + :type public_ip_id: str + :param workload_network_public_ip: NSX Public IP Block. + :type workload_network_public_ip: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkPublicIP or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPublicIP"] + 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_public_ip_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + public_ip_id=public_ip_id, + workload_network_public_ip=workload_network_public_ip, + 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('WorkloadNetworkPublicIP', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'publicIPId': self._serialize.url("public_ip_id", public_ip_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_public_ip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}'} # type: ignore + + async def _delete_public_ip_initial( + self, + resource_group_name: str, + public_ip_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_public_ip_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'publicIPId': self._serialize.url("public_ip_id", public_ip_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.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_public_ip_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}'} # type: ignore + + async def begin_delete_public_ip( + self, + resource_group_name: str, + public_ip_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Public IP Block by id in a private cloud workload network. + + Delete a Public IP Block by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP + Block's display name. + :type public_ip_id: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_public_ip_initial( + resource_group_name=resource_group_name, + public_ip_id=public_ip_id, + private_cloud_name=private_cloud_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'publicIPId': self._serialize.url("public_ip_id", public_ip_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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_public_ip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/__init__.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/__init__.py new file mode 100644 index 000000000000..819b169fecff --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/__init__.py @@ -0,0 +1,337 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import Addon + from ._models_py3 import AddonHcxProperties + from ._models_py3 import AddonList + from ._models_py3 import AddonProperties + from ._models_py3 import AddonSrmProperties + from ._models_py3 import AddonVrProperties + from ._models_py3 import AdminCredentials + from ._models_py3 import Circuit + from ._models_py3 import CloudLink + from ._models_py3 import CloudLinkList + from ._models_py3 import Cluster + from ._models_py3 import ClusterList + from ._models_py3 import ClusterProperties + from ._models_py3 import ClusterUpdate + from ._models_py3 import CommonClusterProperties + from ._models_py3 import Datastore + from ._models_py3 import DatastoreList + from ._models_py3 import DiskPoolVolume + from ._models_py3 import Endpoints + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorResponse + from ._models_py3 import ExpressRouteAuthorization + from ._models_py3 import ExpressRouteAuthorizationList + from ._models_py3 import GlobalReachConnection + from ._models_py3 import GlobalReachConnectionList + from ._models_py3 import HcxEnterpriseSite + from ._models_py3 import HcxEnterpriseSiteList + from ._models_py3 import IdentitySource + from ._models_py3 import LogSpecification + from ._models_py3 import ManagementCluster + from ._models_py3 import MetricDimension + from ._models_py3 import MetricSpecification + from ._models_py3 import NetAppVolume + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationList + from ._models_py3 import OperationProperties + from ._models_py3 import PSCredentialExecutionParameter + from ._models_py3 import PrivateCloud + from ._models_py3 import PrivateCloudList + from ._models_py3 import PrivateCloudProperties + from ._models_py3 import PrivateCloudUpdate + from ._models_py3 import PrivateCloudUpdateProperties + from ._models_py3 import ProxyResource + from ._models_py3 import Quota + from ._models_py3 import Resource + from ._models_py3 import ScriptCmdlet + from ._models_py3 import ScriptCmdletsList + from ._models_py3 import ScriptExecution + from ._models_py3 import ScriptExecutionParameter + from ._models_py3 import ScriptExecutionsList + from ._models_py3 import ScriptPackage + from ._models_py3 import ScriptPackagesList + from ._models_py3 import ScriptParameter + from ._models_py3 import ScriptSecureStringExecutionParameter + from ._models_py3 import ScriptStringExecutionParameter + from ._models_py3 import ServiceSpecification + from ._models_py3 import Sku + from ._models_py3 import TrackedResource + from ._models_py3 import Trial + from ._models_py3 import WorkloadNetworkDhcp + from ._models_py3 import WorkloadNetworkDhcpEntity + from ._models_py3 import WorkloadNetworkDhcpList + from ._models_py3 import WorkloadNetworkDhcpRelay + from ._models_py3 import WorkloadNetworkDhcpServer + from ._models_py3 import WorkloadNetworkDnsService + from ._models_py3 import WorkloadNetworkDnsServicesList + from ._models_py3 import WorkloadNetworkDnsZone + from ._models_py3 import WorkloadNetworkDnsZonesList + from ._models_py3 import WorkloadNetworkGateway + from ._models_py3 import WorkloadNetworkGatewayList + from ._models_py3 import WorkloadNetworkPortMirroring + from ._models_py3 import WorkloadNetworkPortMirroringList + from ._models_py3 import WorkloadNetworkPublicIP + from ._models_py3 import WorkloadNetworkPublicIPsList + from ._models_py3 import WorkloadNetworkSegment + from ._models_py3 import WorkloadNetworkSegmentPortVif + from ._models_py3 import WorkloadNetworkSegmentSubnet + from ._models_py3 import WorkloadNetworkSegmentsList + from ._models_py3 import WorkloadNetworkVMGroup + from ._models_py3 import WorkloadNetworkVMGroupsList + from ._models_py3 import WorkloadNetworkVirtualMachine + from ._models_py3 import WorkloadNetworkVirtualMachinesList +except (SyntaxError, ImportError): + from ._models import Addon # type: ignore + from ._models import AddonHcxProperties # type: ignore + from ._models import AddonList # type: ignore + from ._models import AddonProperties # type: ignore + from ._models import AddonSrmProperties # type: ignore + from ._models import AddonVrProperties # type: ignore + from ._models import AdminCredentials # type: ignore + from ._models import Circuit # type: ignore + from ._models import CloudLink # type: ignore + from ._models import CloudLinkList # type: ignore + from ._models import Cluster # type: ignore + from ._models import ClusterList # type: ignore + from ._models import ClusterProperties # type: ignore + from ._models import ClusterUpdate # type: ignore + from ._models import CommonClusterProperties # type: ignore + from ._models import Datastore # type: ignore + from ._models import DatastoreList # type: ignore + from ._models import DiskPoolVolume # type: ignore + from ._models import Endpoints # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import ExpressRouteAuthorization # type: ignore + from ._models import ExpressRouteAuthorizationList # type: ignore + from ._models import GlobalReachConnection # type: ignore + from ._models import GlobalReachConnectionList # type: ignore + from ._models import HcxEnterpriseSite # type: ignore + from ._models import HcxEnterpriseSiteList # type: ignore + from ._models import IdentitySource # type: ignore + from ._models import LogSpecification # type: ignore + from ._models import ManagementCluster # type: ignore + from ._models import MetricDimension # type: ignore + from ._models import MetricSpecification # type: ignore + from ._models import NetAppVolume # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationList # type: ignore + from ._models import OperationProperties # type: ignore + from ._models import PSCredentialExecutionParameter # type: ignore + from ._models import PrivateCloud # type: ignore + from ._models import PrivateCloudList # type: ignore + from ._models import PrivateCloudProperties # type: ignore + from ._models import PrivateCloudUpdate # type: ignore + from ._models import PrivateCloudUpdateProperties # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import Quota # type: ignore + from ._models import Resource # type: ignore + from ._models import ScriptCmdlet # type: ignore + from ._models import ScriptCmdletsList # type: ignore + from ._models import ScriptExecution # type: ignore + from ._models import ScriptExecutionParameter # type: ignore + from ._models import ScriptExecutionsList # type: ignore + from ._models import ScriptPackage # type: ignore + from ._models import ScriptPackagesList # type: ignore + from ._models import ScriptParameter # type: ignore + from ._models import ScriptSecureStringExecutionParameter # type: ignore + from ._models import ScriptStringExecutionParameter # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import Sku # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import Trial # type: ignore + from ._models import WorkloadNetworkDhcp # type: ignore + from ._models import WorkloadNetworkDhcpEntity # type: ignore + from ._models import WorkloadNetworkDhcpList # type: ignore + from ._models import WorkloadNetworkDhcpRelay # type: ignore + from ._models import WorkloadNetworkDhcpServer # type: ignore + from ._models import WorkloadNetworkDnsService # type: ignore + from ._models import WorkloadNetworkDnsServicesList # type: ignore + from ._models import WorkloadNetworkDnsZone # type: ignore + from ._models import WorkloadNetworkDnsZonesList # type: ignore + from ._models import WorkloadNetworkGateway # type: ignore + from ._models import WorkloadNetworkGatewayList # type: ignore + from ._models import WorkloadNetworkPortMirroring # type: ignore + from ._models import WorkloadNetworkPortMirroringList # type: ignore + from ._models import WorkloadNetworkPublicIP # type: ignore + from ._models import WorkloadNetworkPublicIPsList # type: ignore + from ._models import WorkloadNetworkSegment # type: ignore + from ._models import WorkloadNetworkSegmentPortVif # type: ignore + from ._models import WorkloadNetworkSegmentSubnet # type: ignore + from ._models import WorkloadNetworkSegmentsList # type: ignore + from ._models import WorkloadNetworkVMGroup # type: ignore + from ._models import WorkloadNetworkVMGroupsList # type: ignore + from ._models import WorkloadNetworkVirtualMachine # type: ignore + from ._models import WorkloadNetworkVirtualMachinesList # type: ignore + +from ._avs_client_enums import ( + AddonProvisioningState, + AddonType, + CloudLinkStatus, + ClusterProvisioningState, + DatastoreProvisioningState, + DhcpTypeEnum, + DnsServiceLogLevelEnum, + DnsServiceStatusEnum, + ExpressRouteAuthorizationProvisioningState, + GlobalReachConnectionProvisioningState, + GlobalReachConnectionStatus, + HcxEnterpriseSiteStatus, + InternetEnum, + MountOptionEnum, + OptionalParamEnum, + PortMirroringDirectionEnum, + PortMirroringStatusEnum, + PrivateCloudProvisioningState, + QuotaEnabled, + ScriptExecutionParameterType, + ScriptExecutionProvisioningState, + ScriptOutputStreamType, + ScriptParameterTypes, + SegmentStatusEnum, + SslEnum, + TrialStatus, + VMGroupStatusEnum, + VMTypeEnum, + VisibilityParameterEnum, + WorkloadNetworkDhcpProvisioningState, + WorkloadNetworkDnsServiceProvisioningState, + WorkloadNetworkDnsZoneProvisioningState, + WorkloadNetworkPortMirroringProvisioningState, + WorkloadNetworkPublicIPProvisioningState, + WorkloadNetworkSegmentProvisioningState, + WorkloadNetworkVMGroupProvisioningState, +) + +__all__ = [ + 'Addon', + 'AddonHcxProperties', + 'AddonList', + 'AddonProperties', + 'AddonSrmProperties', + 'AddonVrProperties', + 'AdminCredentials', + 'Circuit', + 'CloudLink', + 'CloudLinkList', + 'Cluster', + 'ClusterList', + 'ClusterProperties', + 'ClusterUpdate', + 'CommonClusterProperties', + 'Datastore', + 'DatastoreList', + 'DiskPoolVolume', + 'Endpoints', + 'ErrorAdditionalInfo', + 'ErrorResponse', + 'ExpressRouteAuthorization', + 'ExpressRouteAuthorizationList', + 'GlobalReachConnection', + 'GlobalReachConnectionList', + 'HcxEnterpriseSite', + 'HcxEnterpriseSiteList', + 'IdentitySource', + 'LogSpecification', + 'ManagementCluster', + 'MetricDimension', + 'MetricSpecification', + 'NetAppVolume', + 'Operation', + 'OperationDisplay', + 'OperationList', + 'OperationProperties', + 'PSCredentialExecutionParameter', + 'PrivateCloud', + 'PrivateCloudList', + 'PrivateCloudProperties', + 'PrivateCloudUpdate', + 'PrivateCloudUpdateProperties', + 'ProxyResource', + 'Quota', + 'Resource', + 'ScriptCmdlet', + 'ScriptCmdletsList', + 'ScriptExecution', + 'ScriptExecutionParameter', + 'ScriptExecutionsList', + 'ScriptPackage', + 'ScriptPackagesList', + 'ScriptParameter', + 'ScriptSecureStringExecutionParameter', + 'ScriptStringExecutionParameter', + 'ServiceSpecification', + 'Sku', + 'TrackedResource', + 'Trial', + 'WorkloadNetworkDhcp', + 'WorkloadNetworkDhcpEntity', + 'WorkloadNetworkDhcpList', + 'WorkloadNetworkDhcpRelay', + 'WorkloadNetworkDhcpServer', + 'WorkloadNetworkDnsService', + 'WorkloadNetworkDnsServicesList', + 'WorkloadNetworkDnsZone', + 'WorkloadNetworkDnsZonesList', + 'WorkloadNetworkGateway', + 'WorkloadNetworkGatewayList', + 'WorkloadNetworkPortMirroring', + 'WorkloadNetworkPortMirroringList', + 'WorkloadNetworkPublicIP', + 'WorkloadNetworkPublicIPsList', + 'WorkloadNetworkSegment', + 'WorkloadNetworkSegmentPortVif', + 'WorkloadNetworkSegmentSubnet', + 'WorkloadNetworkSegmentsList', + 'WorkloadNetworkVMGroup', + 'WorkloadNetworkVMGroupsList', + 'WorkloadNetworkVirtualMachine', + 'WorkloadNetworkVirtualMachinesList', + 'AddonProvisioningState', + 'AddonType', + 'CloudLinkStatus', + 'ClusterProvisioningState', + 'DatastoreProvisioningState', + 'DhcpTypeEnum', + 'DnsServiceLogLevelEnum', + 'DnsServiceStatusEnum', + 'ExpressRouteAuthorizationProvisioningState', + 'GlobalReachConnectionProvisioningState', + 'GlobalReachConnectionStatus', + 'HcxEnterpriseSiteStatus', + 'InternetEnum', + 'MountOptionEnum', + 'OptionalParamEnum', + 'PortMirroringDirectionEnum', + 'PortMirroringStatusEnum', + 'PrivateCloudProvisioningState', + 'QuotaEnabled', + 'ScriptExecutionParameterType', + 'ScriptExecutionProvisioningState', + 'ScriptOutputStreamType', + 'ScriptParameterTypes', + 'SegmentStatusEnum', + 'SslEnum', + 'TrialStatus', + 'VMGroupStatusEnum', + 'VMTypeEnum', + 'VisibilityParameterEnum', + 'WorkloadNetworkDhcpProvisioningState', + 'WorkloadNetworkDnsServiceProvisioningState', + 'WorkloadNetworkDnsZoneProvisioningState', + 'WorkloadNetworkPortMirroringProvisioningState', + 'WorkloadNetworkPublicIPProvisioningState', + 'WorkloadNetworkSegmentProvisioningState', + 'WorkloadNetworkVMGroupProvisioningState', +] diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_avs_client_enums.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_avs_client_enums.py new file mode 100644 index 000000000000..f0a7e9e57cd3 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_avs_client_enums.py @@ -0,0 +1,335 @@ +# 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 AddonProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The state of the addon provisioning + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELLED = "Cancelled" + BUILDING = "Building" + DELETING = "Deleting" + UPDATING = "Updating" + +class AddonType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of private cloud addon + """ + + SRM = "SRM" + VR = "VR" + HCX = "HCX" + +class CloudLinkStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The state of the cloud link. + """ + + ACTIVE = "Active" + BUILDING = "Building" + DELETING = "Deleting" + FAILED = "Failed" + DISCONNECTED = "Disconnected" + +class ClusterProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The state of the cluster provisioning + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELLED = "Cancelled" + DELETING = "Deleting" + UPDATING = "Updating" + +class DatastoreProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The state of the datastore provisioning + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELLED = "Cancelled" + PENDING = "Pending" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + +class DhcpTypeEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of DHCP: SERVER or RELAY. + """ + + SERVER = "SERVER" + RELAY = "RELAY" + +class DnsServiceLogLevelEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """DNS Service log level. + """ + + DEBUG = "DEBUG" + INFO = "INFO" + WARNING = "WARNING" + ERROR = "ERROR" + FATAL = "FATAL" + +class DnsServiceStatusEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """DNS Service status. + """ + + SUCCESS = "SUCCESS" + FAILURE = "FAILURE" + +class ExpressRouteAuthorizationProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The state of the ExpressRoute Circuit Authorization provisioning + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + UPDATING = "Updating" + +class GlobalReachConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The state of the ExpressRoute Circuit Authorization provisioning + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + UPDATING = "Updating" + +class GlobalReachConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The connection status of the global reach connection + """ + + CONNECTED = "Connected" + CONNECTING = "Connecting" + DISCONNECTED = "Disconnected" + +class HcxEnterpriseSiteStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of the HCX Enterprise Site + """ + + AVAILABLE = "Available" + CONSUMED = "Consumed" + DEACTIVATED = "Deactivated" + DELETED = "Deleted" + +class InternetEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Connectivity to internet is enabled or disabled + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class MountOptionEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Mode that describes whether the LUN has to be mounted as a datastore or attached as a LUN + """ + + MOUNT = "MOUNT" + ATTACH = "ATTACH" + +class OptionalParamEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Is this parameter required or optional + """ + + OPTIONAL = "Optional" + REQUIRED = "Required" + +class PortMirroringDirectionEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Direction of port mirroring profile. + """ + + INGRESS_EGRESS_BIDIRECTIONAL = "INGRESS, EGRESS, BIDIRECTIONAL" + +class PortMirroringStatusEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Port Mirroring Status. + """ + + SUCCESS_FAILURE = "SUCCESS, FAILURE" + +class PrivateCloudProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELLED = "Cancelled" + PENDING = "Pending" + BUILDING = "Building" + DELETING = "Deleting" + UPDATING = "Updating" + +class QuotaEnabled(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Host quota is active for current subscription + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class ScriptExecutionParameterType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of execution parameter + """ + + VALUE = "Value" + SECURE_VALUE = "SecureValue" + CREDENTIAL = "Credential" + +class ScriptExecutionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The state of the script execution resource + """ + + PENDING = "Pending" + RUNNING = "Running" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELLING = "Cancelling" + CANCELLED = "Cancelled" + DELETING = "Deleting" + +class ScriptOutputStreamType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + INFORMATION = "Information" + WARNING = "Warning" + OUTPUT = "Output" + ERROR = "Error" + +class ScriptParameterTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of parameter the script is expecting. psCredential is a PSCredentialObject + """ + + STRING = "String" + SECURE_STRING = "SecureString" + CREDENTIAL = "Credential" + INT = "Int" + BOOL = "Bool" + FLOAT = "Float" + +class SegmentStatusEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Segment status. + """ + + SUCCESS_FAILURE = "SUCCESS, FAILURE" + +class SslEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Protect LDAP communication using SSL certificate (LDAPS) + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class TrialStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Trial status + """ + + TRIAL_AVAILABLE = "TrialAvailable" + TRIAL_USED = "TrialUsed" + TRIAL_DISABLED = "TrialDisabled" + +class VisibilityParameterEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Should this parameter be visible to arm and passed in the parameters argument when executing + """ + + VISIBLE = "Visible" + HIDDEN = "Hidden" + +class VMGroupStatusEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """VM Group status. + """ + + SUCCESS_FAILURE = "SUCCESS, FAILURE" + +class VMTypeEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Virtual machine type. + """ + + REGULAR_EDGE_SERVICE = "REGULAR, EDGE, SERVICE" + +class WorkloadNetworkDhcpProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + BUILDING = "Building" + DELETING = "Deleting" + UPDATING = "Updating" + +class WorkloadNetworkDnsServiceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + BUILDING = "Building" + DELETING = "Deleting" + UPDATING = "Updating" + +class WorkloadNetworkDnsZoneProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + BUILDING = "Building" + DELETING = "Deleting" + UPDATING = "Updating" + +class WorkloadNetworkPortMirroringProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + BUILDING = "Building" + DELETING = "Deleting" + UPDATING = "Updating" + +class WorkloadNetworkPublicIPProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + BUILDING = "Building" + DELETING = "Deleting" + UPDATING = "Updating" + +class WorkloadNetworkSegmentProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + BUILDING = "Building" + DELETING = "Deleting" + UPDATING = "Updating" + +class WorkloadNetworkVMGroupProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + BUILDING = "Building" + DELETING = "Deleting" + UPDATING = "Updating" diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_models.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_models.py new file mode 100644 index 000000000000..f3f816b35a72 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_models.py @@ -0,0 +1,3367 @@ +# 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 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: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :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 Addon(Resource): + """An addon resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param properties: The properties of an addon resource. + :type properties: ~azure.mgmt.avs.models.AddonProperties + """ + + _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'}, + 'properties': {'key': 'properties', 'type': 'AddonProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(Addon, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class AddonProperties(msrest.serialization.Model): + """The properties of an addon. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AddonHcxProperties, AddonSrmProperties, AddonVrProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param addon_type: Required. The type of private cloud addon.Constant filled by server. + Possible values include: "SRM", "VR", "HCX". + :type addon_type: str or ~azure.mgmt.avs.models.AddonType + :ivar provisioning_state: The state of the addon provisioning. Possible values include: + "Succeeded", "Failed", "Cancelled", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState + """ + + _validation = { + 'addon_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'addon_type': {'key': 'addonType', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + _subtype_map = { + 'addon_type': {'HCX': 'AddonHcxProperties', 'SRM': 'AddonSrmProperties', 'VR': 'AddonVrProperties'} + } + + def __init__( + self, + **kwargs + ): + super(AddonProperties, self).__init__(**kwargs) + self.addon_type = None # type: Optional[str] + self.provisioning_state = None + + +class AddonHcxProperties(AddonProperties): + """The properties of an HCX addon. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param addon_type: Required. The type of private cloud addon.Constant filled by server. + Possible values include: "SRM", "VR", "HCX". + :type addon_type: str or ~azure.mgmt.avs.models.AddonType + :ivar provisioning_state: The state of the addon provisioning. Possible values include: + "Succeeded", "Failed", "Cancelled", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState + :param offer: Required. The HCX offer, example VMware MaaS Cloud Provider (Enterprise). + :type offer: str + """ + + _validation = { + 'addon_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'offer': {'required': True}, + } + + _attribute_map = { + 'addon_type': {'key': 'addonType', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'offer': {'key': 'offer', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AddonHcxProperties, self).__init__(**kwargs) + self.addon_type = 'HCX' # type: str + self.offer = kwargs['offer'] + + +class AddonList(msrest.serialization.Model): + """A paged list of addons. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on a page. + :vartype value: list[~azure.mgmt.avs.models.Addon] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Addon]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AddonList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class AddonSrmProperties(AddonProperties): + """The properties of a Site Recovery Manager (SRM) addon. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param addon_type: Required. The type of private cloud addon.Constant filled by server. + Possible values include: "SRM", "VR", "HCX". + :type addon_type: str or ~azure.mgmt.avs.models.AddonType + :ivar provisioning_state: The state of the addon provisioning. Possible values include: + "Succeeded", "Failed", "Cancelled", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState + :param license_key: Required. The Site Recovery Manager (SRM) license. + :type license_key: str + """ + + _validation = { + 'addon_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'license_key': {'required': True}, + } + + _attribute_map = { + 'addon_type': {'key': 'addonType', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'license_key': {'key': 'licenseKey', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AddonSrmProperties, self).__init__(**kwargs) + self.addon_type = 'SRM' # type: str + self.license_key = kwargs['license_key'] + + +class AddonVrProperties(AddonProperties): + """The properties of a vSphere Replication (VR) addon. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param addon_type: Required. The type of private cloud addon.Constant filled by server. + Possible values include: "SRM", "VR", "HCX". + :type addon_type: str or ~azure.mgmt.avs.models.AddonType + :ivar provisioning_state: The state of the addon provisioning. Possible values include: + "Succeeded", "Failed", "Cancelled", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState + :param vrs_count: Required. The vSphere Replication Server (VRS) count. + :type vrs_count: int + """ + + _validation = { + 'addon_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'vrs_count': {'required': True}, + } + + _attribute_map = { + 'addon_type': {'key': 'addonType', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'vrs_count': {'key': 'vrsCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(AddonVrProperties, self).__init__(**kwargs) + self.addon_type = 'VR' # type: str + self.vrs_count = kwargs['vrs_count'] + + +class AdminCredentials(msrest.serialization.Model): + """Administrative credentials for accessing vCenter and NSX-T. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar nsxt_username: NSX-T Manager username. + :vartype nsxt_username: str + :ivar nsxt_password: NSX-T Manager password. + :vartype nsxt_password: str + :ivar vcenter_username: vCenter admin username. + :vartype vcenter_username: str + :ivar vcenter_password: vCenter admin password. + :vartype vcenter_password: str + """ + + _validation = { + 'nsxt_username': {'readonly': True}, + 'nsxt_password': {'readonly': True}, + 'vcenter_username': {'readonly': True}, + 'vcenter_password': {'readonly': True}, + } + + _attribute_map = { + 'nsxt_username': {'key': 'nsxtUsername', 'type': 'str'}, + 'nsxt_password': {'key': 'nsxtPassword', 'type': 'str'}, + 'vcenter_username': {'key': 'vcenterUsername', 'type': 'str'}, + 'vcenter_password': {'key': 'vcenterPassword', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AdminCredentials, self).__init__(**kwargs) + self.nsxt_username = None + self.nsxt_password = None + self.vcenter_username = None + self.vcenter_password = None + + +class Circuit(msrest.serialization.Model): + """An ExpressRoute Circuit. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar primary_subnet: CIDR of primary subnet. + :vartype primary_subnet: str + :ivar secondary_subnet: CIDR of secondary subnet. + :vartype secondary_subnet: str + :ivar express_route_id: Identifier of the ExpressRoute Circuit (Microsoft Colo only). + :vartype express_route_id: str + :ivar express_route_private_peering_id: ExpressRoute Circuit private peering identifier. + :vartype express_route_private_peering_id: str + """ + + _validation = { + 'primary_subnet': {'readonly': True}, + 'secondary_subnet': {'readonly': True}, + 'express_route_id': {'readonly': True}, + 'express_route_private_peering_id': {'readonly': True}, + } + + _attribute_map = { + 'primary_subnet': {'key': 'primarySubnet', 'type': 'str'}, + 'secondary_subnet': {'key': 'secondarySubnet', 'type': 'str'}, + 'express_route_id': {'key': 'expressRouteID', 'type': 'str'}, + 'express_route_private_peering_id': {'key': 'expressRoutePrivatePeeringID', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Circuit, self).__init__(**kwargs) + self.primary_subnet = None + self.secondary_subnet = None + self.express_route_id = None + self.express_route_private_peering_id = None + + +class CloudLink(Resource): + """A cloud link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar status: The state of the cloud link. Possible values include: "Active", "Building", + "Deleting", "Failed", "Disconnected". + :vartype status: str or ~azure.mgmt.avs.models.CloudLinkStatus + :param linked_cloud: Identifier of the other private cloud participating in the link. + :type linked_cloud: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'linked_cloud': {'key': 'properties.linkedCloud', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudLink, self).__init__(**kwargs) + self.status = None + self.linked_cloud = kwargs.get('linked_cloud', None) + + +class CloudLinkList(msrest.serialization.Model): + """A paged list of cloud links. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on a page. + :vartype value: list[~azure.mgmt.avs.models.CloudLink] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CloudLink]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudLinkList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class Cluster(Resource): + """A cluster resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param sku: Required. The cluster SKU. + :type sku: ~azure.mgmt.avs.models.Sku + :param cluster_size: The cluster size. + :type cluster_size: int + :ivar provisioning_state: The state of the cluster provisioning. Possible values include: + "Succeeded", "Failed", "Cancelled", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState + :ivar cluster_id: The identity. + :vartype cluster_id: int + :ivar hosts: The hosts. + :vartype hosts: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sku': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'cluster_id': {'readonly': True}, + 'hosts': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'cluster_size': {'key': 'properties.clusterSize', 'type': 'int'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'cluster_id': {'key': 'properties.clusterId', 'type': 'int'}, + 'hosts': {'key': 'properties.hosts', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(Cluster, self).__init__(**kwargs) + self.sku = kwargs['sku'] + self.cluster_size = kwargs.get('cluster_size', None) + self.provisioning_state = None + self.cluster_id = None + self.hosts = None + + +class ClusterList(msrest.serialization.Model): + """A paged list of clusters. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on a page. + :vartype value: list[~azure.mgmt.avs.models.Cluster] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Cluster]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ClusterList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class CommonClusterProperties(msrest.serialization.Model): + """The common properties of a cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param cluster_size: The cluster size. + :type cluster_size: int + :ivar provisioning_state: The state of the cluster provisioning. Possible values include: + "Succeeded", "Failed", "Cancelled", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState + :ivar cluster_id: The identity. + :vartype cluster_id: int + :ivar hosts: The hosts. + :vartype hosts: list[str] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'cluster_id': {'readonly': True}, + 'hosts': {'readonly': True}, + } + + _attribute_map = { + 'cluster_size': {'key': 'clusterSize', 'type': 'int'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'cluster_id': {'key': 'clusterId', 'type': 'int'}, + 'hosts': {'key': 'hosts', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(CommonClusterProperties, self).__init__(**kwargs) + self.cluster_size = kwargs.get('cluster_size', None) + self.provisioning_state = None + self.cluster_id = None + self.hosts = None + + +class ClusterProperties(CommonClusterProperties): + """The properties of a cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param cluster_size: The cluster size. + :type cluster_size: int + :ivar provisioning_state: The state of the cluster provisioning. Possible values include: + "Succeeded", "Failed", "Cancelled", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState + :ivar cluster_id: The identity. + :vartype cluster_id: int + :ivar hosts: The hosts. + :vartype hosts: list[str] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'cluster_id': {'readonly': True}, + 'hosts': {'readonly': True}, + } + + _attribute_map = { + 'cluster_size': {'key': 'clusterSize', 'type': 'int'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'cluster_id': {'key': 'clusterId', 'type': 'int'}, + 'hosts': {'key': 'hosts', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(ClusterProperties, self).__init__(**kwargs) + + +class ClusterUpdate(msrest.serialization.Model): + """An update of a cluster resource. + + :param cluster_size: The cluster size. + :type cluster_size: int + """ + + _attribute_map = { + 'cluster_size': {'key': 'properties.clusterSize', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(ClusterUpdate, self).__init__(**kwargs) + self.cluster_size = kwargs.get('cluster_size', None) + + +class Datastore(Resource): + """A datastore resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar provisioning_state: The state of the datastore provisioning. Possible values include: + "Succeeded", "Failed", "Cancelled", "Pending", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.DatastoreProvisioningState + :param net_app_volume: An Azure NetApp Files volume. + :type net_app_volume: ~azure.mgmt.avs.models.NetAppVolume + :param disk_pool_volume: An iSCSI volume. + :type disk_pool_volume: ~azure.mgmt.avs.models.DiskPoolVolume + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'net_app_volume': {'key': 'properties.netAppVolume', 'type': 'NetAppVolume'}, + 'disk_pool_volume': {'key': 'properties.diskPoolVolume', 'type': 'DiskPoolVolume'}, + } + + def __init__( + self, + **kwargs + ): + super(Datastore, self).__init__(**kwargs) + self.provisioning_state = None + self.net_app_volume = kwargs.get('net_app_volume', None) + self.disk_pool_volume = kwargs.get('disk_pool_volume', None) + + +class DatastoreList(msrest.serialization.Model): + """A paged list of datastores. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on a page. + :vartype value: list[~azure.mgmt.avs.models.Datastore] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Datastore]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DatastoreList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class DiskPoolVolume(msrest.serialization.Model): + """An iSCSI volume from Microsoft.StoragePool provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param target_id: Required. Azure resource ID of the iSCSI target. + :type target_id: str + :param lun_name: Required. Name of the LUN to be used for datastore. + :type lun_name: str + :param mount_option: Mode that describes whether the LUN has to be mounted as a datastore or + attached as a LUN. Possible values include: "MOUNT", "ATTACH". Default value: "MOUNT". + :type mount_option: str or ~azure.mgmt.avs.models.MountOptionEnum + :ivar path: Device path. + :vartype path: str + """ + + _validation = { + 'target_id': {'required': True}, + 'lun_name': {'required': True}, + 'path': {'readonly': True}, + } + + _attribute_map = { + 'target_id': {'key': 'targetId', 'type': 'str'}, + 'lun_name': {'key': 'lunName', 'type': 'str'}, + 'mount_option': {'key': 'mountOption', 'type': 'str'}, + 'path': {'key': 'path', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DiskPoolVolume, self).__init__(**kwargs) + self.target_id = kwargs['target_id'] + self.lun_name = kwargs['lun_name'] + self.mount_option = kwargs.get('mount_option', "MOUNT") + self.path = None + + +class Endpoints(msrest.serialization.Model): + """Endpoint addresses. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar nsxt_manager: Endpoint for the NSX-T Data Center manager. + :vartype nsxt_manager: str + :ivar vcsa: Endpoint for Virtual Center Server Appliance. + :vartype vcsa: str + :ivar hcx_cloud_manager: Endpoint for the HCX Cloud Manager. + :vartype hcx_cloud_manager: str + """ + + _validation = { + 'nsxt_manager': {'readonly': True}, + 'vcsa': {'readonly': True}, + 'hcx_cloud_manager': {'readonly': True}, + } + + _attribute_map = { + 'nsxt_manager': {'key': 'nsxtManager', 'type': 'str'}, + 'vcsa': {'key': 'vcsa', 'type': 'str'}, + 'hcx_cloud_manager': {'key': 'hcxCloudManager', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Endpoints, self).__init__(**kwargs) + self.nsxt_manager = None + self.vcsa = None + self.hcx_cloud_manager = None + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.avs.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.avs.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ExpressRouteAuthorization(Resource): + """ExpressRoute Circuit Authorization. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar provisioning_state: The state of the ExpressRoute Circuit Authorization provisioning. + Possible values include: "Succeeded", "Failed", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.avs.models.ExpressRouteAuthorizationProvisioningState + :ivar express_route_authorization_id: The ID of the ExpressRoute Circuit Authorization. + :vartype express_route_authorization_id: str + :ivar express_route_authorization_key: The key of the ExpressRoute Circuit Authorization. + :vartype express_route_authorization_key: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'express_route_authorization_id': {'readonly': True}, + 'express_route_authorization_key': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'express_route_authorization_id': {'key': 'properties.expressRouteAuthorizationId', 'type': 'str'}, + 'express_route_authorization_key': {'key': 'properties.expressRouteAuthorizationKey', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExpressRouteAuthorization, self).__init__(**kwargs) + self.provisioning_state = None + self.express_route_authorization_id = None + self.express_route_authorization_key = None + + +class ExpressRouteAuthorizationList(msrest.serialization.Model): + """A paged list of ExpressRoute Circuit Authorizations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on a page. + :vartype value: list[~azure.mgmt.avs.models.ExpressRouteAuthorization] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ExpressRouteAuthorization]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExpressRouteAuthorizationList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class GlobalReachConnection(Resource): + """A global reach connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar provisioning_state: The state of the ExpressRoute Circuit Authorization provisioning. + Possible values include: "Succeeded", "Failed", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.avs.models.GlobalReachConnectionProvisioningState + :ivar address_prefix: The network used for global reach carved out from the original network + block provided for the private cloud. + :vartype address_prefix: str + :param authorization_key: Authorization key from the peer express route used for the global + reach connection. + :type authorization_key: str + :ivar circuit_connection_status: The connection status of the global reach connection. Possible + values include: "Connected", "Connecting", "Disconnected". + :vartype circuit_connection_status: str or ~azure.mgmt.avs.models.GlobalReachConnectionStatus + :param peer_express_route_circuit: Identifier of the ExpressRoute Circuit to peer with in the + global reach connection. + :type peer_express_route_circuit: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'address_prefix': {'readonly': True}, + 'circuit_connection_status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'address_prefix': {'key': 'properties.addressPrefix', 'type': 'str'}, + 'authorization_key': {'key': 'properties.authorizationKey', 'type': 'str'}, + 'circuit_connection_status': {'key': 'properties.circuitConnectionStatus', 'type': 'str'}, + 'peer_express_route_circuit': {'key': 'properties.peerExpressRouteCircuit', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GlobalReachConnection, self).__init__(**kwargs) + self.provisioning_state = None + self.address_prefix = None + self.authorization_key = kwargs.get('authorization_key', None) + self.circuit_connection_status = None + self.peer_express_route_circuit = kwargs.get('peer_express_route_circuit', None) + + +class GlobalReachConnectionList(msrest.serialization.Model): + """A paged list of global reach connections. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on a page. + :vartype value: list[~azure.mgmt.avs.models.GlobalReachConnection] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GlobalReachConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GlobalReachConnectionList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class HcxEnterpriseSite(Resource): + """An HCX Enterprise Site resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar activation_key: The activation key. + :vartype activation_key: str + :ivar status: The status of the HCX Enterprise Site. Possible values include: "Available", + "Consumed", "Deactivated", "Deleted". + :vartype status: str or ~azure.mgmt.avs.models.HcxEnterpriseSiteStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'activation_key': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'activation_key': {'key': 'properties.activationKey', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HcxEnterpriseSite, self).__init__(**kwargs) + self.activation_key = None + self.status = None + + +class HcxEnterpriseSiteList(msrest.serialization.Model): + """A paged list of HCX Enterprise Sites. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on a page. + :vartype value: list[~azure.mgmt.avs.models.HcxEnterpriseSite] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HcxEnterpriseSite]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HcxEnterpriseSiteList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class IdentitySource(msrest.serialization.Model): + """vCenter Single Sign On Identity Source. + + :param name: The name of the identity source. + :type name: str + :param alias: The domain's NetBIOS name. + :type alias: str + :param domain: The domain's dns name. + :type domain: str + :param base_user_dn: The base distinguished name for users. + :type base_user_dn: str + :param base_group_dn: The base distinguished name for groups. + :type base_group_dn: str + :param primary_server: Primary server URL. + :type primary_server: str + :param secondary_server: Secondary server URL. + :type secondary_server: str + :param ssl: Protect LDAP communication using SSL certificate (LDAPS). Possible values include: + "Enabled", "Disabled". + :type ssl: str or ~azure.mgmt.avs.models.SslEnum + :param username: The ID of an Active Directory user with a minimum of read-only access to Base + DN for users and group. + :type username: str + :param password: The password of the Active Directory user with a minimum of read-only access + to Base DN for users and groups. + :type password: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'alias': {'key': 'alias', 'type': 'str'}, + 'domain': {'key': 'domain', 'type': 'str'}, + 'base_user_dn': {'key': 'baseUserDN', 'type': 'str'}, + 'base_group_dn': {'key': 'baseGroupDN', 'type': 'str'}, + 'primary_server': {'key': 'primaryServer', 'type': 'str'}, + 'secondary_server': {'key': 'secondaryServer', 'type': 'str'}, + 'ssl': {'key': 'ssl', 'type': 'str'}, + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IdentitySource, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.alias = kwargs.get('alias', None) + self.domain = kwargs.get('domain', None) + self.base_user_dn = kwargs.get('base_user_dn', None) + self.base_group_dn = kwargs.get('base_group_dn', None) + self.primary_server = kwargs.get('primary_server', None) + self.secondary_server = kwargs.get('secondary_server', None) + self.ssl = kwargs.get('ssl', None) + self.username = kwargs.get('username', None) + self.password = kwargs.get('password', None) + + +class LogSpecification(msrest.serialization.Model): + """Specifications of the Log for Azure Monitoring. + + :param name: Name of the log. + :type name: str + :param display_name: Localized friendly display name of the log. + :type display_name: str + :param blob_duration: Blob duration of the log. + :type blob_duration: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LogSpecification, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.blob_duration = kwargs.get('blob_duration', None) + + +class ManagementCluster(CommonClusterProperties): + """The properties of a management cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param cluster_size: The cluster size. + :type cluster_size: int + :ivar provisioning_state: The state of the cluster provisioning. Possible values include: + "Succeeded", "Failed", "Cancelled", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState + :ivar cluster_id: The identity. + :vartype cluster_id: int + :ivar hosts: The hosts. + :vartype hosts: list[str] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'cluster_id': {'readonly': True}, + 'hosts': {'readonly': True}, + } + + _attribute_map = { + 'cluster_size': {'key': 'clusterSize', 'type': 'int'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'cluster_id': {'key': 'clusterId', 'type': 'int'}, + 'hosts': {'key': 'hosts', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementCluster, self).__init__(**kwargs) + + +class MetricDimension(msrest.serialization.Model): + """Specifications of the Dimension of metrics. + + :param name: Name of the dimension. + :type name: str + :param display_name: Localized friendly display name of the dimension. + :type display_name: str + :param internal_name: Name of the dimension as it appears in MDM. + :type internal_name: str + :param to_be_exported_for_shoebox: A boolean flag indicating whether this dimension should be + included for the shoebox export scenario. + :type to_be_exported_for_shoebox: bool + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'internal_name': {'key': 'internalName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(MetricDimension, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.internal_name = kwargs.get('internal_name', None) + self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) + + +class MetricSpecification(msrest.serialization.Model): + """Specifications of the Metrics for Azure Monitoring. + + :param name: Name of the metric. + :type name: str + :param display_name: Localized friendly display name of the metric. + :type display_name: str + :param display_description: Localized friendly description of the metric. + :type display_description: str + :param unit: Unit that makes sense for the metric. + :type unit: str + :param category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :type category: str + :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + Maximum, Total, Count. + :type aggregation_type: str + :param supported_aggregation_types: Supported aggregation types. + :type supported_aggregation_types: list[str] + :param supported_time_grain_types: Supported time grain types. + :type supported_time_grain_types: list[str] + :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :type fill_gap_with_zero: bool + :param dimensions: Dimensions of the metric. + :type dimensions: list[~azure.mgmt.avs.models.MetricDimension] + :param enable_regional_mdm_account: Whether or not the service is using regional MDM accounts. + :type enable_regional_mdm_account: str + :param source_mdm_account: The name of the MDM account. + :type source_mdm_account: str + :param source_mdm_namespace: The name of the MDM namespace. + :type source_mdm_namespace: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, + 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'enable_regional_mdm_account': {'key': 'enableRegionalMdmAccount', 'type': 'str'}, + 'source_mdm_account': {'key': 'sourceMdmAccount', 'type': 'str'}, + 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MetricSpecification, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.display_description = kwargs.get('display_description', None) + self.unit = kwargs.get('unit', None) + self.category = kwargs.get('category', None) + self.aggregation_type = kwargs.get('aggregation_type', None) + self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) + self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) + self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) + self.dimensions = kwargs.get('dimensions', None) + self.enable_regional_mdm_account = kwargs.get('enable_regional_mdm_account', None) + self.source_mdm_account = kwargs.get('source_mdm_account', None) + self.source_mdm_namespace = kwargs.get('source_mdm_namespace', None) + + +class NetAppVolume(msrest.serialization.Model): + """An Azure NetApp Files volume from Microsoft.NetApp provider. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Azure resource ID of the NetApp volume. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetAppVolume, self).__init__(**kwargs) + self.id = kwargs['id'] + + +class Operation(msrest.serialization.Model): + """A REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the operation being performed on this object. + :vartype name: str + :ivar display: Contains the localized display information for this operation. + :vartype display: ~azure.mgmt.avs.models.OperationDisplay + :param is_data_action: Gets or sets a value indicating whether the operation is a data action + or not. + :type is_data_action: bool + :param origin: Origin of the operation. + :type origin: str + :param properties: Properties of the operation. + :type properties: ~azure.mgmt.avs.models.OperationProperties + """ + + _validation = { + 'name': {'readonly': True}, + 'display': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OperationProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = None + self.is_data_action = kwargs.get('is_data_action', None) + self.origin = kwargs.get('origin', None) + self.properties = kwargs.get('properties', None) + + +class OperationDisplay(msrest.serialization.Model): + """Contains the localized display information for this operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Localized friendly form of the resource provider name. + :vartype provider: str + :ivar resource: Localized friendly form of the resource type related to this operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationList(msrest.serialization.Model): + """Pageable list of operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations. + :vartype value: list[~azure.mgmt.avs.models.Operation] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class OperationProperties(msrest.serialization.Model): + """Extra Operation properties. + + :param service_specification: Service specifications of the operation. + :type service_specification: ~azure.mgmt.avs.models.ServiceSpecification + """ + + _attribute_map = { + 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationProperties, self).__init__(**kwargs) + self.service_specification = kwargs.get('service_specification', 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: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, 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'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class PrivateCloud(TrackedResource): + """A private cloud resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Required. The private cloud SKU. + :type sku: ~azure.mgmt.avs.models.Sku + :param management_cluster: The default cluster used for management. + :type management_cluster: ~azure.mgmt.avs.models.ManagementCluster + :param internet: Connectivity to internet is enabled or disabled. Possible values include: + "Enabled", "Disabled". Default value: "Disabled". + :type internet: str or ~azure.mgmt.avs.models.InternetEnum + :param identity_sources: vCenter Single Sign On Identity Sources. + :type identity_sources: list[~azure.mgmt.avs.models.IdentitySource] + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Cancelled", "Pending", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.PrivateCloudProvisioningState + :param circuit: An ExpressRoute Circuit. + :type circuit: ~azure.mgmt.avs.models.Circuit + :ivar endpoints: The endpoints. + :vartype endpoints: ~azure.mgmt.avs.models.Endpoints + :param network_block: The block of addresses should be unique across VNet in your subscription + as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where A,B,C,D are + between 0 and 255, and X is between 0 and 22. + :type network_block: str + :ivar management_network: Network used to access vCenter Server and NSX-T Manager. + :vartype management_network: str + :ivar provisioning_network: Used for virtual machine cold migration, cloning, and snapshot + migration. + :vartype provisioning_network: str + :ivar vmotion_network: Used for live migration of virtual machines. + :vartype vmotion_network: str + :param vcenter_password: Optionally, set the vCenter admin password when the private cloud is + created. + :type vcenter_password: str + :param nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is + created. + :type nsxt_password: str + :ivar vcenter_certificate_thumbprint: Thumbprint of the vCenter Server SSL certificate. + :vartype vcenter_certificate_thumbprint: str + :ivar nsxt_certificate_thumbprint: Thumbprint of the NSX-T Manager SSL certificate. + :vartype nsxt_certificate_thumbprint: str + :ivar external_cloud_links: Array of cloud link IDs from other clouds that connect to this one. + :vartype external_cloud_links: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sku': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'endpoints': {'readonly': True}, + 'management_network': {'readonly': True}, + 'provisioning_network': {'readonly': True}, + 'vmotion_network': {'readonly': True}, + 'vcenter_certificate_thumbprint': {'readonly': True}, + 'nsxt_certificate_thumbprint': {'readonly': True}, + 'external_cloud_links': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'management_cluster': {'key': 'properties.managementCluster', 'type': 'ManagementCluster'}, + 'internet': {'key': 'properties.internet', 'type': 'str'}, + 'identity_sources': {'key': 'properties.identitySources', 'type': '[IdentitySource]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'circuit': {'key': 'properties.circuit', 'type': 'Circuit'}, + 'endpoints': {'key': 'properties.endpoints', 'type': 'Endpoints'}, + 'network_block': {'key': 'properties.networkBlock', 'type': 'str'}, + 'management_network': {'key': 'properties.managementNetwork', 'type': 'str'}, + 'provisioning_network': {'key': 'properties.provisioningNetwork', 'type': 'str'}, + 'vmotion_network': {'key': 'properties.vmotionNetwork', 'type': 'str'}, + 'vcenter_password': {'key': 'properties.vcenterPassword', 'type': 'str'}, + 'nsxt_password': {'key': 'properties.nsxtPassword', 'type': 'str'}, + 'vcenter_certificate_thumbprint': {'key': 'properties.vcenterCertificateThumbprint', 'type': 'str'}, + 'nsxt_certificate_thumbprint': {'key': 'properties.nsxtCertificateThumbprint', 'type': 'str'}, + 'external_cloud_links': {'key': 'properties.externalCloudLinks', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateCloud, self).__init__(**kwargs) + self.sku = kwargs['sku'] + self.management_cluster = kwargs.get('management_cluster', None) + self.internet = kwargs.get('internet', "Disabled") + self.identity_sources = kwargs.get('identity_sources', None) + self.provisioning_state = None + self.circuit = kwargs.get('circuit', None) + self.endpoints = None + self.network_block = kwargs.get('network_block', None) + self.management_network = None + self.provisioning_network = None + self.vmotion_network = None + self.vcenter_password = kwargs.get('vcenter_password', None) + self.nsxt_password = kwargs.get('nsxt_password', None) + self.vcenter_certificate_thumbprint = None + self.nsxt_certificate_thumbprint = None + self.external_cloud_links = None + + +class PrivateCloudList(msrest.serialization.Model): + """A paged list of private clouds. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on the page. + :vartype value: list[~azure.mgmt.avs.models.PrivateCloud] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateCloud]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateCloudList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PrivateCloudUpdateProperties(msrest.serialization.Model): + """The properties of a private cloud resource that may be updated. + + :param management_cluster: The default cluster used for management. + :type management_cluster: ~azure.mgmt.avs.models.ManagementCluster + :param internet: Connectivity to internet is enabled or disabled. Possible values include: + "Enabled", "Disabled". Default value: "Disabled". + :type internet: str or ~azure.mgmt.avs.models.InternetEnum + :param identity_sources: vCenter Single Sign On Identity Sources. + :type identity_sources: list[~azure.mgmt.avs.models.IdentitySource] + """ + + _attribute_map = { + 'management_cluster': {'key': 'managementCluster', 'type': 'ManagementCluster'}, + 'internet': {'key': 'internet', 'type': 'str'}, + 'identity_sources': {'key': 'identitySources', 'type': '[IdentitySource]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateCloudUpdateProperties, self).__init__(**kwargs) + self.management_cluster = kwargs.get('management_cluster', None) + self.internet = kwargs.get('internet', "Disabled") + self.identity_sources = kwargs.get('identity_sources', None) + + +class PrivateCloudProperties(PrivateCloudUpdateProperties): + """The properties of a private cloud resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param management_cluster: The default cluster used for management. + :type management_cluster: ~azure.mgmt.avs.models.ManagementCluster + :param internet: Connectivity to internet is enabled or disabled. Possible values include: + "Enabled", "Disabled". Default value: "Disabled". + :type internet: str or ~azure.mgmt.avs.models.InternetEnum + :param identity_sources: vCenter Single Sign On Identity Sources. + :type identity_sources: list[~azure.mgmt.avs.models.IdentitySource] + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Cancelled", "Pending", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.PrivateCloudProvisioningState + :param circuit: An ExpressRoute Circuit. + :type circuit: ~azure.mgmt.avs.models.Circuit + :ivar endpoints: The endpoints. + :vartype endpoints: ~azure.mgmt.avs.models.Endpoints + :param network_block: Required. The block of addresses should be unique across VNet in your + subscription as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where + A,B,C,D are between 0 and 255, and X is between 0 and 22. + :type network_block: str + :ivar management_network: Network used to access vCenter Server and NSX-T Manager. + :vartype management_network: str + :ivar provisioning_network: Used for virtual machine cold migration, cloning, and snapshot + migration. + :vartype provisioning_network: str + :ivar vmotion_network: Used for live migration of virtual machines. + :vartype vmotion_network: str + :param vcenter_password: Optionally, set the vCenter admin password when the private cloud is + created. + :type vcenter_password: str + :param nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is + created. + :type nsxt_password: str + :ivar vcenter_certificate_thumbprint: Thumbprint of the vCenter Server SSL certificate. + :vartype vcenter_certificate_thumbprint: str + :ivar nsxt_certificate_thumbprint: Thumbprint of the NSX-T Manager SSL certificate. + :vartype nsxt_certificate_thumbprint: str + :ivar external_cloud_links: Array of cloud link IDs from other clouds that connect to this one. + :vartype external_cloud_links: list[str] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'endpoints': {'readonly': True}, + 'network_block': {'required': True}, + 'management_network': {'readonly': True}, + 'provisioning_network': {'readonly': True}, + 'vmotion_network': {'readonly': True}, + 'vcenter_certificate_thumbprint': {'readonly': True}, + 'nsxt_certificate_thumbprint': {'readonly': True}, + 'external_cloud_links': {'readonly': True}, + } + + _attribute_map = { + 'management_cluster': {'key': 'managementCluster', 'type': 'ManagementCluster'}, + 'internet': {'key': 'internet', 'type': 'str'}, + 'identity_sources': {'key': 'identitySources', 'type': '[IdentitySource]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'circuit': {'key': 'circuit', 'type': 'Circuit'}, + 'endpoints': {'key': 'endpoints', 'type': 'Endpoints'}, + 'network_block': {'key': 'networkBlock', 'type': 'str'}, + 'management_network': {'key': 'managementNetwork', 'type': 'str'}, + 'provisioning_network': {'key': 'provisioningNetwork', 'type': 'str'}, + 'vmotion_network': {'key': 'vmotionNetwork', 'type': 'str'}, + 'vcenter_password': {'key': 'vcenterPassword', 'type': 'str'}, + 'nsxt_password': {'key': 'nsxtPassword', 'type': 'str'}, + 'vcenter_certificate_thumbprint': {'key': 'vcenterCertificateThumbprint', 'type': 'str'}, + 'nsxt_certificate_thumbprint': {'key': 'nsxtCertificateThumbprint', 'type': 'str'}, + 'external_cloud_links': {'key': 'externalCloudLinks', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateCloudProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.circuit = kwargs.get('circuit', None) + self.endpoints = None + self.network_block = kwargs['network_block'] + self.management_network = None + self.provisioning_network = None + self.vmotion_network = None + self.vcenter_password = kwargs.get('vcenter_password', None) + self.nsxt_password = kwargs.get('nsxt_password', None) + self.vcenter_certificate_thumbprint = None + self.nsxt_certificate_thumbprint = None + self.external_cloud_links = None + + +class PrivateCloudUpdate(msrest.serialization.Model): + """An update to a private cloud resource. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param management_cluster: The default cluster used for management. + :type management_cluster: ~azure.mgmt.avs.models.ManagementCluster + :param internet: Connectivity to internet is enabled or disabled. Possible values include: + "Enabled", "Disabled". Default value: "Disabled". + :type internet: str or ~azure.mgmt.avs.models.InternetEnum + :param identity_sources: vCenter Single Sign On Identity Sources. + :type identity_sources: list[~azure.mgmt.avs.models.IdentitySource] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'management_cluster': {'key': 'properties.managementCluster', 'type': 'ManagementCluster'}, + 'internet': {'key': 'properties.internet', 'type': 'str'}, + 'identity_sources': {'key': 'properties.identitySources', 'type': '[IdentitySource]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateCloudUpdate, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.management_cluster = kwargs.get('management_cluster', None) + self.internet = kwargs.get('internet', "Disabled") + self.identity_sources = kwargs.get('identity_sources', None) + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :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 ScriptExecutionParameter(msrest.serialization.Model): + """The arguments passed in to the execution. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: PSCredentialExecutionParameter, ScriptSecureStringExecutionParameter, ScriptStringExecutionParameter. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The parameter name. + :type name: str + :param type: Required. The type of execution parameter.Constant filled by server. Possible + values include: "Value", "SecureValue", "Credential". + :type type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'Credential': 'PSCredentialExecutionParameter', 'SecureValue': 'ScriptSecureStringExecutionParameter', 'Value': 'ScriptStringExecutionParameter'} + } + + def __init__( + self, + **kwargs + ): + super(ScriptExecutionParameter, self).__init__(**kwargs) + self.name = kwargs['name'] + self.type = None # type: Optional[str] + + +class PSCredentialExecutionParameter(ScriptExecutionParameter): + """a powershell credential object. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The parameter name. + :type name: str + :param type: Required. The type of execution parameter.Constant filled by server. Possible + values include: "Value", "SecureValue", "Credential". + :type type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType + :param username: username for login. + :type username: str + :param password: password for login. + :type password: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PSCredentialExecutionParameter, self).__init__(**kwargs) + self.type = 'Credential' # type: str + self.username = kwargs.get('username', None) + self.password = kwargs.get('password', None) + + +class Quota(msrest.serialization.Model): + """Subscription quotas. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar hosts_remaining: Remaining hosts quota by sku type. + :vartype hosts_remaining: dict[str, int] + :ivar quota_enabled: Host quota is active for current subscription. Possible values include: + "Enabled", "Disabled". + :vartype quota_enabled: str or ~azure.mgmt.avs.models.QuotaEnabled + """ + + _validation = { + 'hosts_remaining': {'readonly': True}, + 'quota_enabled': {'readonly': True}, + } + + _attribute_map = { + 'hosts_remaining': {'key': 'hostsRemaining', 'type': '{int}'}, + 'quota_enabled': {'key': 'quotaEnabled', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Quota, self).__init__(**kwargs) + self.hosts_remaining = None + self.quota_enabled = None + + +class ScriptCmdlet(ProxyResource): + """A cmdlet available for script execution. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar description: Description of the scripts functionality. + :vartype description: str + :ivar timeout: Recommended time limit for execution. + :vartype timeout: str + :ivar parameters: Parameters the script will accept. + :vartype parameters: list[~azure.mgmt.avs.models.ScriptParameter] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'description': {'readonly': True}, + 'timeout': {'readonly': True}, + 'parameters': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'timeout': {'key': 'properties.timeout', 'type': 'str'}, + 'parameters': {'key': 'properties.parameters', 'type': '[ScriptParameter]'}, + } + + def __init__( + self, + **kwargs + ): + super(ScriptCmdlet, self).__init__(**kwargs) + self.description = None + self.timeout = None + self.parameters = None + + +class ScriptCmdletsList(msrest.serialization.Model): + """Pageable list of scripts/cmdlets. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of scripts. + :vartype value: list[~azure.mgmt.avs.models.ScriptCmdlet] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ScriptCmdlet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ScriptCmdletsList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class ScriptExecution(ProxyResource): + """An instance of a script executed by a user - custom or AVS. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param script_cmdlet_id: A reference to the script cmdlet resource if user is running a AVS + script. + :type script_cmdlet_id: str + :param parameters: Parameters the script will accept. + :type parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter] + :param hidden_parameters: Parameters that will be hidden/not visible to ARM, such as passwords + and credentials. + :type hidden_parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter] + :param failure_reason: Error message if the script was able to run, but if the script itself + had errors or powershell threw an exception. + :type failure_reason: str + :param timeout: Time limit for execution. + :type timeout: str + :param retention: Time to live for the resource. If not provided, will be available for 60 + days. + :type retention: str + :ivar submitted_at: Time the script execution was submitted. + :vartype submitted_at: ~datetime.datetime + :ivar started_at: Time the script execution was started. + :vartype started_at: ~datetime.datetime + :ivar finished_at: Time the script execution was finished. + :vartype finished_at: ~datetime.datetime + :ivar provisioning_state: The state of the script execution resource. Possible values include: + "Pending", "Running", "Succeeded", "Failed", "Cancelling", "Cancelled", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.ScriptExecutionProvisioningState + :param output: Standard output stream from the powershell execution. + :type output: list[str] + :param named_outputs: User-defined dictionary. + :type named_outputs: dict[str, any] + :ivar information: Standard information out stream from the powershell execution. + :vartype information: list[str] + :ivar warnings: Standard warning out stream from the powershell execution. + :vartype warnings: list[str] + :ivar errors: Standard error output stream from the powershell execution. + :vartype errors: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'submitted_at': {'readonly': True}, + 'started_at': {'readonly': True}, + 'finished_at': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'information': {'readonly': True}, + 'warnings': {'readonly': True}, + 'errors': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'script_cmdlet_id': {'key': 'properties.scriptCmdletId', 'type': 'str'}, + 'parameters': {'key': 'properties.parameters', 'type': '[ScriptExecutionParameter]'}, + 'hidden_parameters': {'key': 'properties.hiddenParameters', 'type': '[ScriptExecutionParameter]'}, + 'failure_reason': {'key': 'properties.failureReason', 'type': 'str'}, + 'timeout': {'key': 'properties.timeout', 'type': 'str'}, + 'retention': {'key': 'properties.retention', 'type': 'str'}, + 'submitted_at': {'key': 'properties.submittedAt', 'type': 'iso-8601'}, + 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, + 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'output': {'key': 'properties.output', 'type': '[str]'}, + 'named_outputs': {'key': 'properties.namedOutputs', 'type': '{object}'}, + 'information': {'key': 'properties.information', 'type': '[str]'}, + 'warnings': {'key': 'properties.warnings', 'type': '[str]'}, + 'errors': {'key': 'properties.errors', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(ScriptExecution, self).__init__(**kwargs) + self.script_cmdlet_id = kwargs.get('script_cmdlet_id', None) + self.parameters = kwargs.get('parameters', None) + self.hidden_parameters = kwargs.get('hidden_parameters', None) + self.failure_reason = kwargs.get('failure_reason', None) + self.timeout = kwargs.get('timeout', None) + self.retention = kwargs.get('retention', None) + self.submitted_at = None + self.started_at = None + self.finished_at = None + self.provisioning_state = None + self.output = kwargs.get('output', None) + self.named_outputs = kwargs.get('named_outputs', None) + self.information = None + self.warnings = None + self.errors = None + + +class ScriptExecutionsList(msrest.serialization.Model): + """Pageable list of script executions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of scripts. + :vartype value: list[~azure.mgmt.avs.models.ScriptExecution] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ScriptExecution]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ScriptExecutionsList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class ScriptPackage(ProxyResource): + """Script Package resources available for execution. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar description: User friendly description of the package. + :vartype description: str + :ivar version: Module version. + :vartype version: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'description': {'readonly': True}, + 'version': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ScriptPackage, self).__init__(**kwargs) + self.description = None + self.version = None + + +class ScriptPackagesList(msrest.serialization.Model): + """A list of the available script packages. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of script package resources. + :vartype value: list[~azure.mgmt.avs.models.ScriptPackage] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ScriptPackage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ScriptPackagesList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class ScriptParameter(msrest.serialization.Model): + """An parameter that the script will accept. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of parameter the script is expecting. psCredential is a + PSCredentialObject. Possible values include: "String", "SecureString", "Credential", "Int", + "Bool", "Float". + :vartype type: str or ~azure.mgmt.avs.models.ScriptParameterTypes + :param name: The parameter name that the script will expect a parameter value for. + :type name: str + :ivar description: User friendly description of the parameter. + :vartype description: str + :ivar visibility: Should this parameter be visible to arm and passed in the parameters argument + when executing. Possible values include: "Visible", "Hidden". + :vartype visibility: str or ~azure.mgmt.avs.models.VisibilityParameterEnum + :ivar optional: Is this parameter required or optional. Possible values include: "Optional", + "Required". + :vartype optional: str or ~azure.mgmt.avs.models.OptionalParamEnum + """ + + _validation = { + 'type': {'readonly': True}, + 'description': {'readonly': True}, + 'visibility': {'readonly': True}, + 'optional': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'visibility': {'key': 'visibility', 'type': 'str'}, + 'optional': {'key': 'optional', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ScriptParameter, self).__init__(**kwargs) + self.type = None + self.name = kwargs.get('name', None) + self.description = None + self.visibility = None + self.optional = None + + +class ScriptSecureStringExecutionParameter(ScriptExecutionParameter): + """a plain text value execution parameter. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The parameter name. + :type name: str + :param type: Required. The type of execution parameter.Constant filled by server. Possible + values include: "Value", "SecureValue", "Credential". + :type type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType + :param secure_value: A secure value for the passed parameter, not to be stored in logs. + :type secure_value: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'secure_value': {'key': 'secureValue', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ScriptSecureStringExecutionParameter, self).__init__(**kwargs) + self.type = 'SecureValue' # type: str + self.secure_value = kwargs.get('secure_value', None) + + +class ScriptStringExecutionParameter(ScriptExecutionParameter): + """a plain text value execution parameter. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The parameter name. + :type name: str + :param type: Required. The type of execution parameter.Constant filled by server. Possible + values include: "Value", "SecureValue", "Credential". + :type type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType + :param value: The value for the passed parameter. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ScriptStringExecutionParameter, self).__init__(**kwargs) + self.type = 'Value' # type: str + self.value = kwargs.get('value', None) + + +class ServiceSpecification(msrest.serialization.Model): + """Service specification payload. + + :param log_specifications: Specifications of the Log for Azure Monitoring. + :type log_specifications: list[~azure.mgmt.avs.models.LogSpecification] + :param metric_specifications: Specifications of the Metrics for Azure Monitoring. + :type metric_specifications: list[~azure.mgmt.avs.models.MetricSpecification] + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + } + + def __init__( + self, + **kwargs + ): + super(ServiceSpecification, self).__init__(**kwargs) + self.log_specifications = kwargs.get('log_specifications', None) + self.metric_specifications = kwargs.get('metric_specifications', None) + + +class Sku(msrest.serialization.Model): + """The resource model definition representing SKU. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SKU. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class Trial(msrest.serialization.Model): + """Subscription trial availability. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: Trial status. Possible values include: "TrialAvailable", "TrialUsed", + "TrialDisabled". + :vartype status: str or ~azure.mgmt.avs.models.TrialStatus + :ivar available_hosts: Number of trial hosts available. + :vartype available_hosts: int + """ + + _validation = { + 'status': {'readonly': True}, + 'available_hosts': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'available_hosts': {'key': 'availableHosts', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(Trial, self).__init__(**kwargs) + self.status = None + self.available_hosts = None + + +class WorkloadNetworkDhcp(ProxyResource): + """NSX DHCP. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param properties: DHCP properties. + :type properties: ~azure.mgmt.avs.models.WorkloadNetworkDhcpEntity + """ + + _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'}, + 'properties': {'key': 'properties', 'type': 'WorkloadNetworkDhcpEntity'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkDhcp, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class WorkloadNetworkDhcpEntity(msrest.serialization.Model): + """Base class for WorkloadNetworkDhcpServer and WorkloadNetworkDhcpRelay to inherit from. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: WorkloadNetworkDhcpRelay, WorkloadNetworkDhcpServer. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param dhcp_type: Required. Type of DHCP: SERVER or RELAY.Constant filled by server. Possible + values include: "SERVER", "RELAY". + :type dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum + :param display_name: Display name of the DHCP entity. + :type display_name: str + :ivar segments: NSX Segments consuming DHCP. + :vartype segments: list[str] + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState + :param revision: NSX revision number. + :type revision: long + """ + + _validation = { + 'dhcp_type': {'required': True}, + 'segments': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'dhcp_type': {'key': 'dhcpType', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'segments': {'key': 'segments', 'type': '[str]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'revision': {'key': 'revision', 'type': 'long'}, + } + + _subtype_map = { + 'dhcp_type': {'RELAY': 'WorkloadNetworkDhcpRelay', 'SERVER': 'WorkloadNetworkDhcpServer'} + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkDhcpEntity, self).__init__(**kwargs) + self.dhcp_type = None # type: Optional[str] + self.display_name = kwargs.get('display_name', None) + self.segments = None + self.provisioning_state = None + self.revision = kwargs.get('revision', None) + + +class WorkloadNetworkDhcpList(msrest.serialization.Model): + """A list of NSX dhcp entities. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on the page. + :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkloadNetworkDhcp]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkDhcpList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class WorkloadNetworkDhcpRelay(WorkloadNetworkDhcpEntity): + """NSX DHCP Relay. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param dhcp_type: Required. Type of DHCP: SERVER or RELAY.Constant filled by server. Possible + values include: "SERVER", "RELAY". + :type dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum + :param display_name: Display name of the DHCP entity. + :type display_name: str + :ivar segments: NSX Segments consuming DHCP. + :vartype segments: list[str] + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState + :param revision: NSX revision number. + :type revision: long + :param server_addresses: DHCP Relay Addresses. Max 3. + :type server_addresses: list[str] + """ + + _validation = { + 'dhcp_type': {'required': True}, + 'segments': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'server_addresses': {'max_items': 3, 'min_items': 1}, + } + + _attribute_map = { + 'dhcp_type': {'key': 'dhcpType', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'segments': {'key': 'segments', 'type': '[str]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'revision': {'key': 'revision', 'type': 'long'}, + 'server_addresses': {'key': 'serverAddresses', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkDhcpRelay, self).__init__(**kwargs) + self.dhcp_type = 'RELAY' # type: str + self.server_addresses = kwargs.get('server_addresses', None) + + +class WorkloadNetworkDhcpServer(WorkloadNetworkDhcpEntity): + """NSX DHCP Server. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param dhcp_type: Required. Type of DHCP: SERVER or RELAY.Constant filled by server. Possible + values include: "SERVER", "RELAY". + :type dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum + :param display_name: Display name of the DHCP entity. + :type display_name: str + :ivar segments: NSX Segments consuming DHCP. + :vartype segments: list[str] + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState + :param revision: NSX revision number. + :type revision: long + :param server_address: DHCP Server Address. + :type server_address: str + :param lease_time: DHCP Server Lease Time. + :type lease_time: long + """ + + _validation = { + 'dhcp_type': {'required': True}, + 'segments': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'dhcp_type': {'key': 'dhcpType', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'segments': {'key': 'segments', 'type': '[str]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'revision': {'key': 'revision', 'type': 'long'}, + 'server_address': {'key': 'serverAddress', 'type': 'str'}, + 'lease_time': {'key': 'leaseTime', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkDhcpServer, self).__init__(**kwargs) + self.dhcp_type = 'SERVER' # type: str + self.server_address = kwargs.get('server_address', None) + self.lease_time = kwargs.get('lease_time', None) + + +class WorkloadNetworkDnsService(ProxyResource): + """NSX DNS Service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: Display name of the DNS Service. + :type display_name: str + :param dns_service_ip: DNS service IP of the DNS Service. + :type dns_service_ip: str + :param default_dns_zone: Default DNS zone of the DNS Service. + :type default_dns_zone: str + :param fqdn_zones: FQDN zones of the DNS Service. + :type fqdn_zones: list[str] + :param log_level: DNS Service log level. Possible values include: "DEBUG", "INFO", "WARNING", + "ERROR", "FATAL". + :type log_level: str or ~azure.mgmt.avs.models.DnsServiceLogLevelEnum + :ivar status: DNS Service status. Possible values include: "SUCCESS", "FAILURE". + :vartype status: str or ~azure.mgmt.avs.models.DnsServiceStatusEnum + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.avs.models.WorkloadNetworkDnsServiceProvisioningState + :param revision: NSX revision number. + :type revision: long + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'dns_service_ip': {'key': 'properties.dnsServiceIp', 'type': 'str'}, + 'default_dns_zone': {'key': 'properties.defaultDnsZone', 'type': 'str'}, + 'fqdn_zones': {'key': 'properties.fqdnZones', 'type': '[str]'}, + 'log_level': {'key': 'properties.logLevel', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'revision': {'key': 'properties.revision', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkDnsService, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.dns_service_ip = kwargs.get('dns_service_ip', None) + self.default_dns_zone = kwargs.get('default_dns_zone', None) + self.fqdn_zones = kwargs.get('fqdn_zones', None) + self.log_level = kwargs.get('log_level', None) + self.status = None + self.provisioning_state = None + self.revision = kwargs.get('revision', None) + + +class WorkloadNetworkDnsServicesList(msrest.serialization.Model): + """A list of NSX DNS Services. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on the page. + :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkDnsService] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkloadNetworkDnsService]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkDnsServicesList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class WorkloadNetworkDnsZone(ProxyResource): + """NSX DNS Zone. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: Display name of the DNS Zone. + :type display_name: str + :param domain: Domain names of the DNS Zone. + :type domain: list[str] + :param dns_server_ips: DNS Server IP array of the DNS Zone. + :type dns_server_ips: list[str] + :param source_ip: Source IP of the DNS Zone. + :type source_ip: str + :param dns_services: Number of DNS Services using the DNS zone. + :type dns_services: long + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.avs.models.WorkloadNetworkDnsZoneProvisioningState + :param revision: NSX revision number. + :type revision: long + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'domain': {'key': 'properties.domain', 'type': '[str]'}, + 'dns_server_ips': {'key': 'properties.dnsServerIps', 'type': '[str]'}, + 'source_ip': {'key': 'properties.sourceIp', 'type': 'str'}, + 'dns_services': {'key': 'properties.dnsServices', 'type': 'long'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'revision': {'key': 'properties.revision', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkDnsZone, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.domain = kwargs.get('domain', None) + self.dns_server_ips = kwargs.get('dns_server_ips', None) + self.source_ip = kwargs.get('source_ip', None) + self.dns_services = kwargs.get('dns_services', None) + self.provisioning_state = None + self.revision = kwargs.get('revision', None) + + +class WorkloadNetworkDnsZonesList(msrest.serialization.Model): + """A list of NSX DNS Zones. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on the page. + :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkloadNetworkDnsZone]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkDnsZonesList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class WorkloadNetworkGateway(ProxyResource): + """NSX Gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: Display name of the DHCP entity. + :type display_name: str + :ivar path: NSX Gateway Path. + :vartype path: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'path': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'path': {'key': 'properties.path', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkGateway, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.path = None + + +class WorkloadNetworkGatewayList(msrest.serialization.Model): + """A list of NSX Gateways. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on the page. + :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkGateway] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkloadNetworkGateway]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkGatewayList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class WorkloadNetworkPortMirroring(ProxyResource): + """NSX Port Mirroring. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: Display name of the port mirroring profile. + :type display_name: str + :param direction: Direction of port mirroring profile. Possible values include: "INGRESS, + EGRESS, BIDIRECTIONAL". + :type direction: str or ~azure.mgmt.avs.models.PortMirroringDirectionEnum + :param source: Source VM Group. + :type source: str + :param destination: Destination VM Group. + :type destination: str + :ivar status: Port Mirroring Status. Possible values include: "SUCCESS, FAILURE". + :vartype status: str or ~azure.mgmt.avs.models.PortMirroringStatusEnum + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.avs.models.WorkloadNetworkPortMirroringProvisioningState + :param revision: NSX revision number. + :type revision: long + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'destination': {'key': 'properties.destination', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'revision': {'key': 'properties.revision', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkPortMirroring, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.direction = kwargs.get('direction', None) + self.source = kwargs.get('source', None) + self.destination = kwargs.get('destination', None) + self.status = None + self.provisioning_state = None + self.revision = kwargs.get('revision', None) + + +class WorkloadNetworkPortMirroringList(msrest.serialization.Model): + """A list of NSX Port Mirroring. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on the page. + :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkloadNetworkPortMirroring]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkPortMirroringList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class WorkloadNetworkPublicIP(ProxyResource): + """NSX Public IP Block. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: Display name of the Public IP Block. + :type display_name: str + :param number_of_public_i_ps: Number of Public IPs requested. + :type number_of_public_i_ps: long + :ivar public_ip_block: CIDR Block of the Public IP Block. + :vartype public_ip_block: str + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.avs.models.WorkloadNetworkPublicIPProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'public_ip_block': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'number_of_public_i_ps': {'key': 'properties.numberOfPublicIPs', 'type': 'long'}, + 'public_ip_block': {'key': 'properties.publicIPBlock', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkPublicIP, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.number_of_public_i_ps = kwargs.get('number_of_public_i_ps', None) + self.public_ip_block = None + self.provisioning_state = None + + +class WorkloadNetworkPublicIPsList(msrest.serialization.Model): + """A list of NSX Public IP Blocks. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on the page. + :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkloadNetworkPublicIP]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkPublicIPsList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class WorkloadNetworkSegment(ProxyResource): + """NSX Segment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: Display name of the segment. + :type display_name: str + :param connected_gateway: Gateway which to connect segment to. + :type connected_gateway: str + :param subnet: Subnet which to connect segment to. + :type subnet: ~azure.mgmt.avs.models.WorkloadNetworkSegmentSubnet + :ivar port_vif: Port Vif which segment is associated with. + :vartype port_vif: list[~azure.mgmt.avs.models.WorkloadNetworkSegmentPortVif] + :ivar status: Segment status. Possible values include: "SUCCESS, FAILURE". + :vartype status: str or ~azure.mgmt.avs.models.SegmentStatusEnum + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.avs.models.WorkloadNetworkSegmentProvisioningState + :param revision: NSX revision number. + :type revision: long + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'port_vif': {'readonly': True}, + 'status': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'connected_gateway': {'key': 'properties.connectedGateway', 'type': 'str'}, + 'subnet': {'key': 'properties.subnet', 'type': 'WorkloadNetworkSegmentSubnet'}, + 'port_vif': {'key': 'properties.portVif', 'type': '[WorkloadNetworkSegmentPortVif]'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'revision': {'key': 'properties.revision', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkSegment, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.connected_gateway = kwargs.get('connected_gateway', None) + self.subnet = kwargs.get('subnet', None) + self.port_vif = None + self.status = None + self.provisioning_state = None + self.revision = kwargs.get('revision', None) + + +class WorkloadNetworkSegmentPortVif(msrest.serialization.Model): + """Ports and any VIF attached to segment. + + :param port_name: Name of port or VIF attached to segment. + :type port_name: str + """ + + _attribute_map = { + 'port_name': {'key': 'portName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkSegmentPortVif, self).__init__(**kwargs) + self.port_name = kwargs.get('port_name', None) + + +class WorkloadNetworkSegmentsList(msrest.serialization.Model): + """A list of NSX Segments. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on the page. + :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkloadNetworkSegment]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkSegmentsList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class WorkloadNetworkSegmentSubnet(msrest.serialization.Model): + """Subnet configuration for segment. + + :param dhcp_ranges: DHCP Range assigned for subnet. + :type dhcp_ranges: list[str] + :param gateway_address: Gateway address. + :type gateway_address: str + """ + + _attribute_map = { + 'dhcp_ranges': {'key': 'dhcpRanges', 'type': '[str]'}, + 'gateway_address': {'key': 'gatewayAddress', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkSegmentSubnet, self).__init__(**kwargs) + self.dhcp_ranges = kwargs.get('dhcp_ranges', None) + self.gateway_address = kwargs.get('gateway_address', None) + + +class WorkloadNetworkVirtualMachine(ProxyResource): + """NSX Virtual Machine. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: Display name of the VM. + :type display_name: str + :ivar vm_type: Virtual machine type. Possible values include: "REGULAR, EDGE, SERVICE". + :vartype vm_type: str or ~azure.mgmt.avs.models.VMTypeEnum + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'vm_type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'vm_type': {'key': 'properties.vmType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkVirtualMachine, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.vm_type = None + + +class WorkloadNetworkVirtualMachinesList(msrest.serialization.Model): + """A list of NSX Virtual Machines. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on the page. + :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkloadNetworkVirtualMachine]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkVirtualMachinesList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class WorkloadNetworkVMGroup(ProxyResource): + """NSX VM Group. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: Display name of the VM group. + :type display_name: str + :param members: Virtual machine members of this group. + :type members: list[str] + :ivar status: VM Group status. Possible values include: "SUCCESS, FAILURE". + :vartype status: str or ~azure.mgmt.avs.models.VMGroupStatusEnum + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.avs.models.WorkloadNetworkVMGroupProvisioningState + :param revision: NSX revision number. + :type revision: long + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'members': {'key': 'properties.members', 'type': '[str]'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'revision': {'key': 'properties.revision', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkVMGroup, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.members = kwargs.get('members', None) + self.status = None + self.provisioning_state = None + self.revision = kwargs.get('revision', None) + + +class WorkloadNetworkVMGroupsList(msrest.serialization.Model): + """A list of NSX VM Groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on the page. + :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkloadNetworkVMGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkVMGroupsList, self).__init__(**kwargs) + self.value = None + self.next_link = None diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_models_py3.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_models_py3.py new file mode 100644 index 000000000000..68f82c05b3fe --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_models_py3.py @@ -0,0 +1,3558 @@ +# 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, Dict, List, Optional, Union + +import msrest.serialization + +from ._avs_client_enums import * + + +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: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :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 Addon(Resource): + """An addon resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param properties: The properties of an addon resource. + :type properties: ~azure.mgmt.avs.models.AddonProperties + """ + + _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'}, + 'properties': {'key': 'properties', 'type': 'AddonProperties'}, + } + + def __init__( + self, + *, + properties: Optional["AddonProperties"] = None, + **kwargs + ): + super(Addon, self).__init__(**kwargs) + self.properties = properties + + +class AddonProperties(msrest.serialization.Model): + """The properties of an addon. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AddonHcxProperties, AddonSrmProperties, AddonVrProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param addon_type: Required. The type of private cloud addon.Constant filled by server. + Possible values include: "SRM", "VR", "HCX". + :type addon_type: str or ~azure.mgmt.avs.models.AddonType + :ivar provisioning_state: The state of the addon provisioning. Possible values include: + "Succeeded", "Failed", "Cancelled", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState + """ + + _validation = { + 'addon_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'addon_type': {'key': 'addonType', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + _subtype_map = { + 'addon_type': {'HCX': 'AddonHcxProperties', 'SRM': 'AddonSrmProperties', 'VR': 'AddonVrProperties'} + } + + def __init__( + self, + **kwargs + ): + super(AddonProperties, self).__init__(**kwargs) + self.addon_type = None # type: Optional[str] + self.provisioning_state = None + + +class AddonHcxProperties(AddonProperties): + """The properties of an HCX addon. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param addon_type: Required. The type of private cloud addon.Constant filled by server. + Possible values include: "SRM", "VR", "HCX". + :type addon_type: str or ~azure.mgmt.avs.models.AddonType + :ivar provisioning_state: The state of the addon provisioning. Possible values include: + "Succeeded", "Failed", "Cancelled", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState + :param offer: Required. The HCX offer, example VMware MaaS Cloud Provider (Enterprise). + :type offer: str + """ + + _validation = { + 'addon_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'offer': {'required': True}, + } + + _attribute_map = { + 'addon_type': {'key': 'addonType', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'offer': {'key': 'offer', 'type': 'str'}, + } + + def __init__( + self, + *, + offer: str, + **kwargs + ): + super(AddonHcxProperties, self).__init__(**kwargs) + self.addon_type = 'HCX' # type: str + self.offer = offer + + +class AddonList(msrest.serialization.Model): + """A paged list of addons. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on a page. + :vartype value: list[~azure.mgmt.avs.models.Addon] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Addon]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AddonList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class AddonSrmProperties(AddonProperties): + """The properties of a Site Recovery Manager (SRM) addon. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param addon_type: Required. The type of private cloud addon.Constant filled by server. + Possible values include: "SRM", "VR", "HCX". + :type addon_type: str or ~azure.mgmt.avs.models.AddonType + :ivar provisioning_state: The state of the addon provisioning. Possible values include: + "Succeeded", "Failed", "Cancelled", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState + :param license_key: Required. The Site Recovery Manager (SRM) license. + :type license_key: str + """ + + _validation = { + 'addon_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'license_key': {'required': True}, + } + + _attribute_map = { + 'addon_type': {'key': 'addonType', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'license_key': {'key': 'licenseKey', 'type': 'str'}, + } + + def __init__( + self, + *, + license_key: str, + **kwargs + ): + super(AddonSrmProperties, self).__init__(**kwargs) + self.addon_type = 'SRM' # type: str + self.license_key = license_key + + +class AddonVrProperties(AddonProperties): + """The properties of a vSphere Replication (VR) addon. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param addon_type: Required. The type of private cloud addon.Constant filled by server. + Possible values include: "SRM", "VR", "HCX". + :type addon_type: str or ~azure.mgmt.avs.models.AddonType + :ivar provisioning_state: The state of the addon provisioning. Possible values include: + "Succeeded", "Failed", "Cancelled", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState + :param vrs_count: Required. The vSphere Replication Server (VRS) count. + :type vrs_count: int + """ + + _validation = { + 'addon_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'vrs_count': {'required': True}, + } + + _attribute_map = { + 'addon_type': {'key': 'addonType', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'vrs_count': {'key': 'vrsCount', 'type': 'int'}, + } + + def __init__( + self, + *, + vrs_count: int, + **kwargs + ): + super(AddonVrProperties, self).__init__(**kwargs) + self.addon_type = 'VR' # type: str + self.vrs_count = vrs_count + + +class AdminCredentials(msrest.serialization.Model): + """Administrative credentials for accessing vCenter and NSX-T. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar nsxt_username: NSX-T Manager username. + :vartype nsxt_username: str + :ivar nsxt_password: NSX-T Manager password. + :vartype nsxt_password: str + :ivar vcenter_username: vCenter admin username. + :vartype vcenter_username: str + :ivar vcenter_password: vCenter admin password. + :vartype vcenter_password: str + """ + + _validation = { + 'nsxt_username': {'readonly': True}, + 'nsxt_password': {'readonly': True}, + 'vcenter_username': {'readonly': True}, + 'vcenter_password': {'readonly': True}, + } + + _attribute_map = { + 'nsxt_username': {'key': 'nsxtUsername', 'type': 'str'}, + 'nsxt_password': {'key': 'nsxtPassword', 'type': 'str'}, + 'vcenter_username': {'key': 'vcenterUsername', 'type': 'str'}, + 'vcenter_password': {'key': 'vcenterPassword', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AdminCredentials, self).__init__(**kwargs) + self.nsxt_username = None + self.nsxt_password = None + self.vcenter_username = None + self.vcenter_password = None + + +class Circuit(msrest.serialization.Model): + """An ExpressRoute Circuit. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar primary_subnet: CIDR of primary subnet. + :vartype primary_subnet: str + :ivar secondary_subnet: CIDR of secondary subnet. + :vartype secondary_subnet: str + :ivar express_route_id: Identifier of the ExpressRoute Circuit (Microsoft Colo only). + :vartype express_route_id: str + :ivar express_route_private_peering_id: ExpressRoute Circuit private peering identifier. + :vartype express_route_private_peering_id: str + """ + + _validation = { + 'primary_subnet': {'readonly': True}, + 'secondary_subnet': {'readonly': True}, + 'express_route_id': {'readonly': True}, + 'express_route_private_peering_id': {'readonly': True}, + } + + _attribute_map = { + 'primary_subnet': {'key': 'primarySubnet', 'type': 'str'}, + 'secondary_subnet': {'key': 'secondarySubnet', 'type': 'str'}, + 'express_route_id': {'key': 'expressRouteID', 'type': 'str'}, + 'express_route_private_peering_id': {'key': 'expressRoutePrivatePeeringID', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Circuit, self).__init__(**kwargs) + self.primary_subnet = None + self.secondary_subnet = None + self.express_route_id = None + self.express_route_private_peering_id = None + + +class CloudLink(Resource): + """A cloud link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar status: The state of the cloud link. Possible values include: "Active", "Building", + "Deleting", "Failed", "Disconnected". + :vartype status: str or ~azure.mgmt.avs.models.CloudLinkStatus + :param linked_cloud: Identifier of the other private cloud participating in the link. + :type linked_cloud: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'linked_cloud': {'key': 'properties.linkedCloud', 'type': 'str'}, + } + + def __init__( + self, + *, + linked_cloud: Optional[str] = None, + **kwargs + ): + super(CloudLink, self).__init__(**kwargs) + self.status = None + self.linked_cloud = linked_cloud + + +class CloudLinkList(msrest.serialization.Model): + """A paged list of cloud links. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on a page. + :vartype value: list[~azure.mgmt.avs.models.CloudLink] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CloudLink]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudLinkList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class Cluster(Resource): + """A cluster resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param sku: Required. The cluster SKU. + :type sku: ~azure.mgmt.avs.models.Sku + :param cluster_size: The cluster size. + :type cluster_size: int + :ivar provisioning_state: The state of the cluster provisioning. Possible values include: + "Succeeded", "Failed", "Cancelled", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState + :ivar cluster_id: The identity. + :vartype cluster_id: int + :ivar hosts: The hosts. + :vartype hosts: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sku': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'cluster_id': {'readonly': True}, + 'hosts': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'cluster_size': {'key': 'properties.clusterSize', 'type': 'int'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'cluster_id': {'key': 'properties.clusterId', 'type': 'int'}, + 'hosts': {'key': 'properties.hosts', 'type': '[str]'}, + } + + def __init__( + self, + *, + sku: "Sku", + cluster_size: Optional[int] = None, + **kwargs + ): + super(Cluster, self).__init__(**kwargs) + self.sku = sku + self.cluster_size = cluster_size + self.provisioning_state = None + self.cluster_id = None + self.hosts = None + + +class ClusterList(msrest.serialization.Model): + """A paged list of clusters. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on a page. + :vartype value: list[~azure.mgmt.avs.models.Cluster] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Cluster]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ClusterList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class CommonClusterProperties(msrest.serialization.Model): + """The common properties of a cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param cluster_size: The cluster size. + :type cluster_size: int + :ivar provisioning_state: The state of the cluster provisioning. Possible values include: + "Succeeded", "Failed", "Cancelled", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState + :ivar cluster_id: The identity. + :vartype cluster_id: int + :ivar hosts: The hosts. + :vartype hosts: list[str] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'cluster_id': {'readonly': True}, + 'hosts': {'readonly': True}, + } + + _attribute_map = { + 'cluster_size': {'key': 'clusterSize', 'type': 'int'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'cluster_id': {'key': 'clusterId', 'type': 'int'}, + 'hosts': {'key': 'hosts', 'type': '[str]'}, + } + + def __init__( + self, + *, + cluster_size: Optional[int] = None, + **kwargs + ): + super(CommonClusterProperties, self).__init__(**kwargs) + self.cluster_size = cluster_size + self.provisioning_state = None + self.cluster_id = None + self.hosts = None + + +class ClusterProperties(CommonClusterProperties): + """The properties of a cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param cluster_size: The cluster size. + :type cluster_size: int + :ivar provisioning_state: The state of the cluster provisioning. Possible values include: + "Succeeded", "Failed", "Cancelled", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState + :ivar cluster_id: The identity. + :vartype cluster_id: int + :ivar hosts: The hosts. + :vartype hosts: list[str] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'cluster_id': {'readonly': True}, + 'hosts': {'readonly': True}, + } + + _attribute_map = { + 'cluster_size': {'key': 'clusterSize', 'type': 'int'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'cluster_id': {'key': 'clusterId', 'type': 'int'}, + 'hosts': {'key': 'hosts', 'type': '[str]'}, + } + + def __init__( + self, + *, + cluster_size: Optional[int] = None, + **kwargs + ): + super(ClusterProperties, self).__init__(cluster_size=cluster_size, **kwargs) + + +class ClusterUpdate(msrest.serialization.Model): + """An update of a cluster resource. + + :param cluster_size: The cluster size. + :type cluster_size: int + """ + + _attribute_map = { + 'cluster_size': {'key': 'properties.clusterSize', 'type': 'int'}, + } + + def __init__( + self, + *, + cluster_size: Optional[int] = None, + **kwargs + ): + super(ClusterUpdate, self).__init__(**kwargs) + self.cluster_size = cluster_size + + +class Datastore(Resource): + """A datastore resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar provisioning_state: The state of the datastore provisioning. Possible values include: + "Succeeded", "Failed", "Cancelled", "Pending", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.DatastoreProvisioningState + :param net_app_volume: An Azure NetApp Files volume. + :type net_app_volume: ~azure.mgmt.avs.models.NetAppVolume + :param disk_pool_volume: An iSCSI volume. + :type disk_pool_volume: ~azure.mgmt.avs.models.DiskPoolVolume + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'net_app_volume': {'key': 'properties.netAppVolume', 'type': 'NetAppVolume'}, + 'disk_pool_volume': {'key': 'properties.diskPoolVolume', 'type': 'DiskPoolVolume'}, + } + + def __init__( + self, + *, + net_app_volume: Optional["NetAppVolume"] = None, + disk_pool_volume: Optional["DiskPoolVolume"] = None, + **kwargs + ): + super(Datastore, self).__init__(**kwargs) + self.provisioning_state = None + self.net_app_volume = net_app_volume + self.disk_pool_volume = disk_pool_volume + + +class DatastoreList(msrest.serialization.Model): + """A paged list of datastores. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on a page. + :vartype value: list[~azure.mgmt.avs.models.Datastore] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Datastore]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DatastoreList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class DiskPoolVolume(msrest.serialization.Model): + """An iSCSI volume from Microsoft.StoragePool provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param target_id: Required. Azure resource ID of the iSCSI target. + :type target_id: str + :param lun_name: Required. Name of the LUN to be used for datastore. + :type lun_name: str + :param mount_option: Mode that describes whether the LUN has to be mounted as a datastore or + attached as a LUN. Possible values include: "MOUNT", "ATTACH". Default value: "MOUNT". + :type mount_option: str or ~azure.mgmt.avs.models.MountOptionEnum + :ivar path: Device path. + :vartype path: str + """ + + _validation = { + 'target_id': {'required': True}, + 'lun_name': {'required': True}, + 'path': {'readonly': True}, + } + + _attribute_map = { + 'target_id': {'key': 'targetId', 'type': 'str'}, + 'lun_name': {'key': 'lunName', 'type': 'str'}, + 'mount_option': {'key': 'mountOption', 'type': 'str'}, + 'path': {'key': 'path', 'type': 'str'}, + } + + def __init__( + self, + *, + target_id: str, + lun_name: str, + mount_option: Optional[Union[str, "MountOptionEnum"]] = "MOUNT", + **kwargs + ): + super(DiskPoolVolume, self).__init__(**kwargs) + self.target_id = target_id + self.lun_name = lun_name + self.mount_option = mount_option + self.path = None + + +class Endpoints(msrest.serialization.Model): + """Endpoint addresses. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar nsxt_manager: Endpoint for the NSX-T Data Center manager. + :vartype nsxt_manager: str + :ivar vcsa: Endpoint for Virtual Center Server Appliance. + :vartype vcsa: str + :ivar hcx_cloud_manager: Endpoint for the HCX Cloud Manager. + :vartype hcx_cloud_manager: str + """ + + _validation = { + 'nsxt_manager': {'readonly': True}, + 'vcsa': {'readonly': True}, + 'hcx_cloud_manager': {'readonly': True}, + } + + _attribute_map = { + 'nsxt_manager': {'key': 'nsxtManager', 'type': 'str'}, + 'vcsa': {'key': 'vcsa', 'type': 'str'}, + 'hcx_cloud_manager': {'key': 'hcxCloudManager', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Endpoints, self).__init__(**kwargs) + self.nsxt_manager = None + self.vcsa = None + self.hcx_cloud_manager = None + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.avs.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.avs.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ExpressRouteAuthorization(Resource): + """ExpressRoute Circuit Authorization. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar provisioning_state: The state of the ExpressRoute Circuit Authorization provisioning. + Possible values include: "Succeeded", "Failed", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.avs.models.ExpressRouteAuthorizationProvisioningState + :ivar express_route_authorization_id: The ID of the ExpressRoute Circuit Authorization. + :vartype express_route_authorization_id: str + :ivar express_route_authorization_key: The key of the ExpressRoute Circuit Authorization. + :vartype express_route_authorization_key: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'express_route_authorization_id': {'readonly': True}, + 'express_route_authorization_key': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'express_route_authorization_id': {'key': 'properties.expressRouteAuthorizationId', 'type': 'str'}, + 'express_route_authorization_key': {'key': 'properties.expressRouteAuthorizationKey', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExpressRouteAuthorization, self).__init__(**kwargs) + self.provisioning_state = None + self.express_route_authorization_id = None + self.express_route_authorization_key = None + + +class ExpressRouteAuthorizationList(msrest.serialization.Model): + """A paged list of ExpressRoute Circuit Authorizations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on a page. + :vartype value: list[~azure.mgmt.avs.models.ExpressRouteAuthorization] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ExpressRouteAuthorization]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExpressRouteAuthorizationList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class GlobalReachConnection(Resource): + """A global reach connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar provisioning_state: The state of the ExpressRoute Circuit Authorization provisioning. + Possible values include: "Succeeded", "Failed", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.avs.models.GlobalReachConnectionProvisioningState + :ivar address_prefix: The network used for global reach carved out from the original network + block provided for the private cloud. + :vartype address_prefix: str + :param authorization_key: Authorization key from the peer express route used for the global + reach connection. + :type authorization_key: str + :ivar circuit_connection_status: The connection status of the global reach connection. Possible + values include: "Connected", "Connecting", "Disconnected". + :vartype circuit_connection_status: str or ~azure.mgmt.avs.models.GlobalReachConnectionStatus + :param peer_express_route_circuit: Identifier of the ExpressRoute Circuit to peer with in the + global reach connection. + :type peer_express_route_circuit: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'address_prefix': {'readonly': True}, + 'circuit_connection_status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'address_prefix': {'key': 'properties.addressPrefix', 'type': 'str'}, + 'authorization_key': {'key': 'properties.authorizationKey', 'type': 'str'}, + 'circuit_connection_status': {'key': 'properties.circuitConnectionStatus', 'type': 'str'}, + 'peer_express_route_circuit': {'key': 'properties.peerExpressRouteCircuit', 'type': 'str'}, + } + + def __init__( + self, + *, + authorization_key: Optional[str] = None, + peer_express_route_circuit: Optional[str] = None, + **kwargs + ): + super(GlobalReachConnection, self).__init__(**kwargs) + self.provisioning_state = None + self.address_prefix = None + self.authorization_key = authorization_key + self.circuit_connection_status = None + self.peer_express_route_circuit = peer_express_route_circuit + + +class GlobalReachConnectionList(msrest.serialization.Model): + """A paged list of global reach connections. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on a page. + :vartype value: list[~azure.mgmt.avs.models.GlobalReachConnection] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GlobalReachConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GlobalReachConnectionList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class HcxEnterpriseSite(Resource): + """An HCX Enterprise Site resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar activation_key: The activation key. + :vartype activation_key: str + :ivar status: The status of the HCX Enterprise Site. Possible values include: "Available", + "Consumed", "Deactivated", "Deleted". + :vartype status: str or ~azure.mgmt.avs.models.HcxEnterpriseSiteStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'activation_key': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'activation_key': {'key': 'properties.activationKey', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HcxEnterpriseSite, self).__init__(**kwargs) + self.activation_key = None + self.status = None + + +class HcxEnterpriseSiteList(msrest.serialization.Model): + """A paged list of HCX Enterprise Sites. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on a page. + :vartype value: list[~azure.mgmt.avs.models.HcxEnterpriseSite] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HcxEnterpriseSite]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HcxEnterpriseSiteList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class IdentitySource(msrest.serialization.Model): + """vCenter Single Sign On Identity Source. + + :param name: The name of the identity source. + :type name: str + :param alias: The domain's NetBIOS name. + :type alias: str + :param domain: The domain's dns name. + :type domain: str + :param base_user_dn: The base distinguished name for users. + :type base_user_dn: str + :param base_group_dn: The base distinguished name for groups. + :type base_group_dn: str + :param primary_server: Primary server URL. + :type primary_server: str + :param secondary_server: Secondary server URL. + :type secondary_server: str + :param ssl: Protect LDAP communication using SSL certificate (LDAPS). Possible values include: + "Enabled", "Disabled". + :type ssl: str or ~azure.mgmt.avs.models.SslEnum + :param username: The ID of an Active Directory user with a minimum of read-only access to Base + DN for users and group. + :type username: str + :param password: The password of the Active Directory user with a minimum of read-only access + to Base DN for users and groups. + :type password: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'alias': {'key': 'alias', 'type': 'str'}, + 'domain': {'key': 'domain', 'type': 'str'}, + 'base_user_dn': {'key': 'baseUserDN', 'type': 'str'}, + 'base_group_dn': {'key': 'baseGroupDN', 'type': 'str'}, + 'primary_server': {'key': 'primaryServer', 'type': 'str'}, + 'secondary_server': {'key': 'secondaryServer', 'type': 'str'}, + 'ssl': {'key': 'ssl', 'type': 'str'}, + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + alias: Optional[str] = None, + domain: Optional[str] = None, + base_user_dn: Optional[str] = None, + base_group_dn: Optional[str] = None, + primary_server: Optional[str] = None, + secondary_server: Optional[str] = None, + ssl: Optional[Union[str, "SslEnum"]] = None, + username: Optional[str] = None, + password: Optional[str] = None, + **kwargs + ): + super(IdentitySource, self).__init__(**kwargs) + self.name = name + self.alias = alias + self.domain = domain + self.base_user_dn = base_user_dn + self.base_group_dn = base_group_dn + self.primary_server = primary_server + self.secondary_server = secondary_server + self.ssl = ssl + self.username = username + self.password = password + + +class LogSpecification(msrest.serialization.Model): + """Specifications of the Log for Azure Monitoring. + + :param name: Name of the log. + :type name: str + :param display_name: Localized friendly display name of the log. + :type display_name: str + :param blob_duration: Blob duration of the log. + :type blob_duration: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): + super(LogSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.blob_duration = blob_duration + + +class ManagementCluster(CommonClusterProperties): + """The properties of a management cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param cluster_size: The cluster size. + :type cluster_size: int + :ivar provisioning_state: The state of the cluster provisioning. Possible values include: + "Succeeded", "Failed", "Cancelled", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState + :ivar cluster_id: The identity. + :vartype cluster_id: int + :ivar hosts: The hosts. + :vartype hosts: list[str] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'cluster_id': {'readonly': True}, + 'hosts': {'readonly': True}, + } + + _attribute_map = { + 'cluster_size': {'key': 'clusterSize', 'type': 'int'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'cluster_id': {'key': 'clusterId', 'type': 'int'}, + 'hosts': {'key': 'hosts', 'type': '[str]'}, + } + + def __init__( + self, + *, + cluster_size: Optional[int] = None, + **kwargs + ): + super(ManagementCluster, self).__init__(cluster_size=cluster_size, **kwargs) + + +class MetricDimension(msrest.serialization.Model): + """Specifications of the Dimension of metrics. + + :param name: Name of the dimension. + :type name: str + :param display_name: Localized friendly display name of the dimension. + :type display_name: str + :param internal_name: Name of the dimension as it appears in MDM. + :type internal_name: str + :param to_be_exported_for_shoebox: A boolean flag indicating whether this dimension should be + included for the shoebox export scenario. + :type to_be_exported_for_shoebox: bool + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'internal_name': {'key': 'internalName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + internal_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs + ): + super(MetricDimension, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.internal_name = internal_name + self.to_be_exported_for_shoebox = to_be_exported_for_shoebox + + +class MetricSpecification(msrest.serialization.Model): + """Specifications of the Metrics for Azure Monitoring. + + :param name: Name of the metric. + :type name: str + :param display_name: Localized friendly display name of the metric. + :type display_name: str + :param display_description: Localized friendly description of the metric. + :type display_description: str + :param unit: Unit that makes sense for the metric. + :type unit: str + :param category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :type category: str + :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + Maximum, Total, Count. + :type aggregation_type: str + :param supported_aggregation_types: Supported aggregation types. + :type supported_aggregation_types: list[str] + :param supported_time_grain_types: Supported time grain types. + :type supported_time_grain_types: list[str] + :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :type fill_gap_with_zero: bool + :param dimensions: Dimensions of the metric. + :type dimensions: list[~azure.mgmt.avs.models.MetricDimension] + :param enable_regional_mdm_account: Whether or not the service is using regional MDM accounts. + :type enable_regional_mdm_account: str + :param source_mdm_account: The name of the MDM account. + :type source_mdm_account: str + :param source_mdm_namespace: The name of the MDM namespace. + :type source_mdm_namespace: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, + 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'enable_regional_mdm_account': {'key': 'enableRegionalMdmAccount', 'type': 'str'}, + 'source_mdm_account': {'key': 'sourceMdmAccount', 'type': 'str'}, + 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + category: Optional[str] = None, + aggregation_type: Optional[str] = None, + supported_aggregation_types: Optional[List[str]] = None, + supported_time_grain_types: Optional[List[str]] = None, + fill_gap_with_zero: Optional[bool] = None, + dimensions: Optional[List["MetricDimension"]] = None, + enable_regional_mdm_account: Optional[str] = None, + source_mdm_account: Optional[str] = None, + source_mdm_namespace: Optional[str] = None, + **kwargs + ): + super(MetricSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.category = category + self.aggregation_type = aggregation_type + self.supported_aggregation_types = supported_aggregation_types + self.supported_time_grain_types = supported_time_grain_types + self.fill_gap_with_zero = fill_gap_with_zero + self.dimensions = dimensions + self.enable_regional_mdm_account = enable_regional_mdm_account + self.source_mdm_account = source_mdm_account + self.source_mdm_namespace = source_mdm_namespace + + +class NetAppVolume(msrest.serialization.Model): + """An Azure NetApp Files volume from Microsoft.NetApp provider. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Azure resource ID of the NetApp volume. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: str, + **kwargs + ): + super(NetAppVolume, self).__init__(**kwargs) + self.id = id + + +class Operation(msrest.serialization.Model): + """A REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the operation being performed on this object. + :vartype name: str + :ivar display: Contains the localized display information for this operation. + :vartype display: ~azure.mgmt.avs.models.OperationDisplay + :param is_data_action: Gets or sets a value indicating whether the operation is a data action + or not. + :type is_data_action: bool + :param origin: Origin of the operation. + :type origin: str + :param properties: Properties of the operation. + :type properties: ~azure.mgmt.avs.models.OperationProperties + """ + + _validation = { + 'name': {'readonly': True}, + 'display': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OperationProperties'}, + } + + def __init__( + self, + *, + is_data_action: Optional[bool] = None, + origin: Optional[str] = None, + properties: Optional["OperationProperties"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = None + self.is_data_action = is_data_action + self.origin = origin + self.properties = properties + + +class OperationDisplay(msrest.serialization.Model): + """Contains the localized display information for this operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Localized friendly form of the resource provider name. + :vartype provider: str + :ivar resource: Localized friendly form of the resource type related to this operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationList(msrest.serialization.Model): + """Pageable list of operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations. + :vartype value: list[~azure.mgmt.avs.models.Operation] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class OperationProperties(msrest.serialization.Model): + """Extra Operation properties. + + :param service_specification: Service specifications of the operation. + :type service_specification: ~azure.mgmt.avs.models.ServiceSpecification + """ + + _attribute_map = { + 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__( + self, + *, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): + super(OperationProperties, self).__init__(**kwargs) + self.service_specification = service_specification + + +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: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, 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'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.location = location + self.tags = tags + + +class PrivateCloud(TrackedResource): + """A private cloud resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Required. The private cloud SKU. + :type sku: ~azure.mgmt.avs.models.Sku + :param management_cluster: The default cluster used for management. + :type management_cluster: ~azure.mgmt.avs.models.ManagementCluster + :param internet: Connectivity to internet is enabled or disabled. Possible values include: + "Enabled", "Disabled". Default value: "Disabled". + :type internet: str or ~azure.mgmt.avs.models.InternetEnum + :param identity_sources: vCenter Single Sign On Identity Sources. + :type identity_sources: list[~azure.mgmt.avs.models.IdentitySource] + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Cancelled", "Pending", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.PrivateCloudProvisioningState + :param circuit: An ExpressRoute Circuit. + :type circuit: ~azure.mgmt.avs.models.Circuit + :ivar endpoints: The endpoints. + :vartype endpoints: ~azure.mgmt.avs.models.Endpoints + :param network_block: The block of addresses should be unique across VNet in your subscription + as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where A,B,C,D are + between 0 and 255, and X is between 0 and 22. + :type network_block: str + :ivar management_network: Network used to access vCenter Server and NSX-T Manager. + :vartype management_network: str + :ivar provisioning_network: Used for virtual machine cold migration, cloning, and snapshot + migration. + :vartype provisioning_network: str + :ivar vmotion_network: Used for live migration of virtual machines. + :vartype vmotion_network: str + :param vcenter_password: Optionally, set the vCenter admin password when the private cloud is + created. + :type vcenter_password: str + :param nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is + created. + :type nsxt_password: str + :ivar vcenter_certificate_thumbprint: Thumbprint of the vCenter Server SSL certificate. + :vartype vcenter_certificate_thumbprint: str + :ivar nsxt_certificate_thumbprint: Thumbprint of the NSX-T Manager SSL certificate. + :vartype nsxt_certificate_thumbprint: str + :ivar external_cloud_links: Array of cloud link IDs from other clouds that connect to this one. + :vartype external_cloud_links: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sku': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'endpoints': {'readonly': True}, + 'management_network': {'readonly': True}, + 'provisioning_network': {'readonly': True}, + 'vmotion_network': {'readonly': True}, + 'vcenter_certificate_thumbprint': {'readonly': True}, + 'nsxt_certificate_thumbprint': {'readonly': True}, + 'external_cloud_links': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'management_cluster': {'key': 'properties.managementCluster', 'type': 'ManagementCluster'}, + 'internet': {'key': 'properties.internet', 'type': 'str'}, + 'identity_sources': {'key': 'properties.identitySources', 'type': '[IdentitySource]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'circuit': {'key': 'properties.circuit', 'type': 'Circuit'}, + 'endpoints': {'key': 'properties.endpoints', 'type': 'Endpoints'}, + 'network_block': {'key': 'properties.networkBlock', 'type': 'str'}, + 'management_network': {'key': 'properties.managementNetwork', 'type': 'str'}, + 'provisioning_network': {'key': 'properties.provisioningNetwork', 'type': 'str'}, + 'vmotion_network': {'key': 'properties.vmotionNetwork', 'type': 'str'}, + 'vcenter_password': {'key': 'properties.vcenterPassword', 'type': 'str'}, + 'nsxt_password': {'key': 'properties.nsxtPassword', 'type': 'str'}, + 'vcenter_certificate_thumbprint': {'key': 'properties.vcenterCertificateThumbprint', 'type': 'str'}, + 'nsxt_certificate_thumbprint': {'key': 'properties.nsxtCertificateThumbprint', 'type': 'str'}, + 'external_cloud_links': {'key': 'properties.externalCloudLinks', 'type': '[str]'}, + } + + def __init__( + self, + *, + sku: "Sku", + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + management_cluster: Optional["ManagementCluster"] = None, + internet: Optional[Union[str, "InternetEnum"]] = "Disabled", + identity_sources: Optional[List["IdentitySource"]] = None, + circuit: Optional["Circuit"] = None, + network_block: Optional[str] = None, + vcenter_password: Optional[str] = None, + nsxt_password: Optional[str] = None, + **kwargs + ): + super(PrivateCloud, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.management_cluster = management_cluster + self.internet = internet + self.identity_sources = identity_sources + self.provisioning_state = None + self.circuit = circuit + self.endpoints = None + self.network_block = network_block + self.management_network = None + self.provisioning_network = None + self.vmotion_network = None + self.vcenter_password = vcenter_password + self.nsxt_password = nsxt_password + self.vcenter_certificate_thumbprint = None + self.nsxt_certificate_thumbprint = None + self.external_cloud_links = None + + +class PrivateCloudList(msrest.serialization.Model): + """A paged list of private clouds. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on the page. + :vartype value: list[~azure.mgmt.avs.models.PrivateCloud] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateCloud]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateCloudList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PrivateCloudUpdateProperties(msrest.serialization.Model): + """The properties of a private cloud resource that may be updated. + + :param management_cluster: The default cluster used for management. + :type management_cluster: ~azure.mgmt.avs.models.ManagementCluster + :param internet: Connectivity to internet is enabled or disabled. Possible values include: + "Enabled", "Disabled". Default value: "Disabled". + :type internet: str or ~azure.mgmt.avs.models.InternetEnum + :param identity_sources: vCenter Single Sign On Identity Sources. + :type identity_sources: list[~azure.mgmt.avs.models.IdentitySource] + """ + + _attribute_map = { + 'management_cluster': {'key': 'managementCluster', 'type': 'ManagementCluster'}, + 'internet': {'key': 'internet', 'type': 'str'}, + 'identity_sources': {'key': 'identitySources', 'type': '[IdentitySource]'}, + } + + def __init__( + self, + *, + management_cluster: Optional["ManagementCluster"] = None, + internet: Optional[Union[str, "InternetEnum"]] = "Disabled", + identity_sources: Optional[List["IdentitySource"]] = None, + **kwargs + ): + super(PrivateCloudUpdateProperties, self).__init__(**kwargs) + self.management_cluster = management_cluster + self.internet = internet + self.identity_sources = identity_sources + + +class PrivateCloudProperties(PrivateCloudUpdateProperties): + """The properties of a private cloud resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param management_cluster: The default cluster used for management. + :type management_cluster: ~azure.mgmt.avs.models.ManagementCluster + :param internet: Connectivity to internet is enabled or disabled. Possible values include: + "Enabled", "Disabled". Default value: "Disabled". + :type internet: str or ~azure.mgmt.avs.models.InternetEnum + :param identity_sources: vCenter Single Sign On Identity Sources. + :type identity_sources: list[~azure.mgmt.avs.models.IdentitySource] + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Cancelled", "Pending", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.PrivateCloudProvisioningState + :param circuit: An ExpressRoute Circuit. + :type circuit: ~azure.mgmt.avs.models.Circuit + :ivar endpoints: The endpoints. + :vartype endpoints: ~azure.mgmt.avs.models.Endpoints + :param network_block: Required. The block of addresses should be unique across VNet in your + subscription as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where + A,B,C,D are between 0 and 255, and X is between 0 and 22. + :type network_block: str + :ivar management_network: Network used to access vCenter Server and NSX-T Manager. + :vartype management_network: str + :ivar provisioning_network: Used for virtual machine cold migration, cloning, and snapshot + migration. + :vartype provisioning_network: str + :ivar vmotion_network: Used for live migration of virtual machines. + :vartype vmotion_network: str + :param vcenter_password: Optionally, set the vCenter admin password when the private cloud is + created. + :type vcenter_password: str + :param nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is + created. + :type nsxt_password: str + :ivar vcenter_certificate_thumbprint: Thumbprint of the vCenter Server SSL certificate. + :vartype vcenter_certificate_thumbprint: str + :ivar nsxt_certificate_thumbprint: Thumbprint of the NSX-T Manager SSL certificate. + :vartype nsxt_certificate_thumbprint: str + :ivar external_cloud_links: Array of cloud link IDs from other clouds that connect to this one. + :vartype external_cloud_links: list[str] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'endpoints': {'readonly': True}, + 'network_block': {'required': True}, + 'management_network': {'readonly': True}, + 'provisioning_network': {'readonly': True}, + 'vmotion_network': {'readonly': True}, + 'vcenter_certificate_thumbprint': {'readonly': True}, + 'nsxt_certificate_thumbprint': {'readonly': True}, + 'external_cloud_links': {'readonly': True}, + } + + _attribute_map = { + 'management_cluster': {'key': 'managementCluster', 'type': 'ManagementCluster'}, + 'internet': {'key': 'internet', 'type': 'str'}, + 'identity_sources': {'key': 'identitySources', 'type': '[IdentitySource]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'circuit': {'key': 'circuit', 'type': 'Circuit'}, + 'endpoints': {'key': 'endpoints', 'type': 'Endpoints'}, + 'network_block': {'key': 'networkBlock', 'type': 'str'}, + 'management_network': {'key': 'managementNetwork', 'type': 'str'}, + 'provisioning_network': {'key': 'provisioningNetwork', 'type': 'str'}, + 'vmotion_network': {'key': 'vmotionNetwork', 'type': 'str'}, + 'vcenter_password': {'key': 'vcenterPassword', 'type': 'str'}, + 'nsxt_password': {'key': 'nsxtPassword', 'type': 'str'}, + 'vcenter_certificate_thumbprint': {'key': 'vcenterCertificateThumbprint', 'type': 'str'}, + 'nsxt_certificate_thumbprint': {'key': 'nsxtCertificateThumbprint', 'type': 'str'}, + 'external_cloud_links': {'key': 'externalCloudLinks', 'type': '[str]'}, + } + + def __init__( + self, + *, + network_block: str, + management_cluster: Optional["ManagementCluster"] = None, + internet: Optional[Union[str, "InternetEnum"]] = "Disabled", + identity_sources: Optional[List["IdentitySource"]] = None, + circuit: Optional["Circuit"] = None, + vcenter_password: Optional[str] = None, + nsxt_password: Optional[str] = None, + **kwargs + ): + super(PrivateCloudProperties, self).__init__(management_cluster=management_cluster, internet=internet, identity_sources=identity_sources, **kwargs) + self.provisioning_state = None + self.circuit = circuit + self.endpoints = None + self.network_block = network_block + self.management_network = None + self.provisioning_network = None + self.vmotion_network = None + self.vcenter_password = vcenter_password + self.nsxt_password = nsxt_password + self.vcenter_certificate_thumbprint = None + self.nsxt_certificate_thumbprint = None + self.external_cloud_links = None + + +class PrivateCloudUpdate(msrest.serialization.Model): + """An update to a private cloud resource. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param management_cluster: The default cluster used for management. + :type management_cluster: ~azure.mgmt.avs.models.ManagementCluster + :param internet: Connectivity to internet is enabled or disabled. Possible values include: + "Enabled", "Disabled". Default value: "Disabled". + :type internet: str or ~azure.mgmt.avs.models.InternetEnum + :param identity_sources: vCenter Single Sign On Identity Sources. + :type identity_sources: list[~azure.mgmt.avs.models.IdentitySource] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'management_cluster': {'key': 'properties.managementCluster', 'type': 'ManagementCluster'}, + 'internet': {'key': 'properties.internet', 'type': 'str'}, + 'identity_sources': {'key': 'properties.identitySources', 'type': '[IdentitySource]'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + management_cluster: Optional["ManagementCluster"] = None, + internet: Optional[Union[str, "InternetEnum"]] = "Disabled", + identity_sources: Optional[List["IdentitySource"]] = None, + **kwargs + ): + super(PrivateCloudUpdate, self).__init__(**kwargs) + self.tags = tags + self.management_cluster = management_cluster + self.internet = internet + self.identity_sources = identity_sources + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :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 ScriptExecutionParameter(msrest.serialization.Model): + """The arguments passed in to the execution. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: PSCredentialExecutionParameter, ScriptSecureStringExecutionParameter, ScriptStringExecutionParameter. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The parameter name. + :type name: str + :param type: Required. The type of execution parameter.Constant filled by server. Possible + values include: "Value", "SecureValue", "Credential". + :type type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'Credential': 'PSCredentialExecutionParameter', 'SecureValue': 'ScriptSecureStringExecutionParameter', 'Value': 'ScriptStringExecutionParameter'} + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(ScriptExecutionParameter, self).__init__(**kwargs) + self.name = name + self.type = None # type: Optional[str] + + +class PSCredentialExecutionParameter(ScriptExecutionParameter): + """a powershell credential object. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The parameter name. + :type name: str + :param type: Required. The type of execution parameter.Constant filled by server. Possible + values include: "Value", "SecureValue", "Credential". + :type type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType + :param username: username for login. + :type username: str + :param password: password for login. + :type password: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + username: Optional[str] = None, + password: Optional[str] = None, + **kwargs + ): + super(PSCredentialExecutionParameter, self).__init__(name=name, **kwargs) + self.type = 'Credential' # type: str + self.username = username + self.password = password + + +class Quota(msrest.serialization.Model): + """Subscription quotas. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar hosts_remaining: Remaining hosts quota by sku type. + :vartype hosts_remaining: dict[str, int] + :ivar quota_enabled: Host quota is active for current subscription. Possible values include: + "Enabled", "Disabled". + :vartype quota_enabled: str or ~azure.mgmt.avs.models.QuotaEnabled + """ + + _validation = { + 'hosts_remaining': {'readonly': True}, + 'quota_enabled': {'readonly': True}, + } + + _attribute_map = { + 'hosts_remaining': {'key': 'hostsRemaining', 'type': '{int}'}, + 'quota_enabled': {'key': 'quotaEnabled', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Quota, self).__init__(**kwargs) + self.hosts_remaining = None + self.quota_enabled = None + + +class ScriptCmdlet(ProxyResource): + """A cmdlet available for script execution. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar description: Description of the scripts functionality. + :vartype description: str + :ivar timeout: Recommended time limit for execution. + :vartype timeout: str + :ivar parameters: Parameters the script will accept. + :vartype parameters: list[~azure.mgmt.avs.models.ScriptParameter] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'description': {'readonly': True}, + 'timeout': {'readonly': True}, + 'parameters': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'timeout': {'key': 'properties.timeout', 'type': 'str'}, + 'parameters': {'key': 'properties.parameters', 'type': '[ScriptParameter]'}, + } + + def __init__( + self, + **kwargs + ): + super(ScriptCmdlet, self).__init__(**kwargs) + self.description = None + self.timeout = None + self.parameters = None + + +class ScriptCmdletsList(msrest.serialization.Model): + """Pageable list of scripts/cmdlets. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of scripts. + :vartype value: list[~azure.mgmt.avs.models.ScriptCmdlet] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ScriptCmdlet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ScriptCmdletsList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class ScriptExecution(ProxyResource): + """An instance of a script executed by a user - custom or AVS. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param script_cmdlet_id: A reference to the script cmdlet resource if user is running a AVS + script. + :type script_cmdlet_id: str + :param parameters: Parameters the script will accept. + :type parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter] + :param hidden_parameters: Parameters that will be hidden/not visible to ARM, such as passwords + and credentials. + :type hidden_parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter] + :param failure_reason: Error message if the script was able to run, but if the script itself + had errors or powershell threw an exception. + :type failure_reason: str + :param timeout: Time limit for execution. + :type timeout: str + :param retention: Time to live for the resource. If not provided, will be available for 60 + days. + :type retention: str + :ivar submitted_at: Time the script execution was submitted. + :vartype submitted_at: ~datetime.datetime + :ivar started_at: Time the script execution was started. + :vartype started_at: ~datetime.datetime + :ivar finished_at: Time the script execution was finished. + :vartype finished_at: ~datetime.datetime + :ivar provisioning_state: The state of the script execution resource. Possible values include: + "Pending", "Running", "Succeeded", "Failed", "Cancelling", "Cancelled", "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.ScriptExecutionProvisioningState + :param output: Standard output stream from the powershell execution. + :type output: list[str] + :param named_outputs: User-defined dictionary. + :type named_outputs: dict[str, any] + :ivar information: Standard information out stream from the powershell execution. + :vartype information: list[str] + :ivar warnings: Standard warning out stream from the powershell execution. + :vartype warnings: list[str] + :ivar errors: Standard error output stream from the powershell execution. + :vartype errors: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'submitted_at': {'readonly': True}, + 'started_at': {'readonly': True}, + 'finished_at': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'information': {'readonly': True}, + 'warnings': {'readonly': True}, + 'errors': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'script_cmdlet_id': {'key': 'properties.scriptCmdletId', 'type': 'str'}, + 'parameters': {'key': 'properties.parameters', 'type': '[ScriptExecutionParameter]'}, + 'hidden_parameters': {'key': 'properties.hiddenParameters', 'type': '[ScriptExecutionParameter]'}, + 'failure_reason': {'key': 'properties.failureReason', 'type': 'str'}, + 'timeout': {'key': 'properties.timeout', 'type': 'str'}, + 'retention': {'key': 'properties.retention', 'type': 'str'}, + 'submitted_at': {'key': 'properties.submittedAt', 'type': 'iso-8601'}, + 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, + 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'output': {'key': 'properties.output', 'type': '[str]'}, + 'named_outputs': {'key': 'properties.namedOutputs', 'type': '{object}'}, + 'information': {'key': 'properties.information', 'type': '[str]'}, + 'warnings': {'key': 'properties.warnings', 'type': '[str]'}, + 'errors': {'key': 'properties.errors', 'type': '[str]'}, + } + + def __init__( + self, + *, + script_cmdlet_id: Optional[str] = None, + parameters: Optional[List["ScriptExecutionParameter"]] = None, + hidden_parameters: Optional[List["ScriptExecutionParameter"]] = None, + failure_reason: Optional[str] = None, + timeout: Optional[str] = None, + retention: Optional[str] = None, + output: Optional[List[str]] = None, + named_outputs: Optional[Dict[str, Any]] = None, + **kwargs + ): + super(ScriptExecution, self).__init__(**kwargs) + self.script_cmdlet_id = script_cmdlet_id + self.parameters = parameters + self.hidden_parameters = hidden_parameters + self.failure_reason = failure_reason + self.timeout = timeout + self.retention = retention + self.submitted_at = None + self.started_at = None + self.finished_at = None + self.provisioning_state = None + self.output = output + self.named_outputs = named_outputs + self.information = None + self.warnings = None + self.errors = None + + +class ScriptExecutionsList(msrest.serialization.Model): + """Pageable list of script executions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of scripts. + :vartype value: list[~azure.mgmt.avs.models.ScriptExecution] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ScriptExecution]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ScriptExecutionsList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class ScriptPackage(ProxyResource): + """Script Package resources available for execution. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar description: User friendly description of the package. + :vartype description: str + :ivar version: Module version. + :vartype version: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'description': {'readonly': True}, + 'version': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ScriptPackage, self).__init__(**kwargs) + self.description = None + self.version = None + + +class ScriptPackagesList(msrest.serialization.Model): + """A list of the available script packages. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of script package resources. + :vartype value: list[~azure.mgmt.avs.models.ScriptPackage] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ScriptPackage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ScriptPackagesList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class ScriptParameter(msrest.serialization.Model): + """An parameter that the script will accept. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of parameter the script is expecting. psCredential is a + PSCredentialObject. Possible values include: "String", "SecureString", "Credential", "Int", + "Bool", "Float". + :vartype type: str or ~azure.mgmt.avs.models.ScriptParameterTypes + :param name: The parameter name that the script will expect a parameter value for. + :type name: str + :ivar description: User friendly description of the parameter. + :vartype description: str + :ivar visibility: Should this parameter be visible to arm and passed in the parameters argument + when executing. Possible values include: "Visible", "Hidden". + :vartype visibility: str or ~azure.mgmt.avs.models.VisibilityParameterEnum + :ivar optional: Is this parameter required or optional. Possible values include: "Optional", + "Required". + :vartype optional: str or ~azure.mgmt.avs.models.OptionalParamEnum + """ + + _validation = { + 'type': {'readonly': True}, + 'description': {'readonly': True}, + 'visibility': {'readonly': True}, + 'optional': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'visibility': {'key': 'visibility', 'type': 'str'}, + 'optional': {'key': 'optional', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): + super(ScriptParameter, self).__init__(**kwargs) + self.type = None + self.name = name + self.description = None + self.visibility = None + self.optional = None + + +class ScriptSecureStringExecutionParameter(ScriptExecutionParameter): + """a plain text value execution parameter. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The parameter name. + :type name: str + :param type: Required. The type of execution parameter.Constant filled by server. Possible + values include: "Value", "SecureValue", "Credential". + :type type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType + :param secure_value: A secure value for the passed parameter, not to be stored in logs. + :type secure_value: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'secure_value': {'key': 'secureValue', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + secure_value: Optional[str] = None, + **kwargs + ): + super(ScriptSecureStringExecutionParameter, self).__init__(name=name, **kwargs) + self.type = 'SecureValue' # type: str + self.secure_value = secure_value + + +class ScriptStringExecutionParameter(ScriptExecutionParameter): + """a plain text value execution parameter. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The parameter name. + :type name: str + :param type: Required. The type of execution parameter.Constant filled by server. Possible + values include: "Value", "SecureValue", "Credential". + :type type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType + :param value: The value for the passed parameter. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + value: Optional[str] = None, + **kwargs + ): + super(ScriptStringExecutionParameter, self).__init__(name=name, **kwargs) + self.type = 'Value' # type: str + self.value = value + + +class ServiceSpecification(msrest.serialization.Model): + """Service specification payload. + + :param log_specifications: Specifications of the Log for Azure Monitoring. + :type log_specifications: list[~azure.mgmt.avs.models.LogSpecification] + :param metric_specifications: Specifications of the Metrics for Azure Monitoring. + :type metric_specifications: list[~azure.mgmt.avs.models.MetricSpecification] + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + } + + def __init__( + self, + *, + log_specifications: Optional[List["LogSpecification"]] = None, + metric_specifications: Optional[List["MetricSpecification"]] = None, + **kwargs + ): + super(ServiceSpecification, self).__init__(**kwargs) + self.log_specifications = log_specifications + self.metric_specifications = metric_specifications + + +class Sku(msrest.serialization.Model): + """The resource model definition representing SKU. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SKU. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = name + + +class Trial(msrest.serialization.Model): + """Subscription trial availability. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: Trial status. Possible values include: "TrialAvailable", "TrialUsed", + "TrialDisabled". + :vartype status: str or ~azure.mgmt.avs.models.TrialStatus + :ivar available_hosts: Number of trial hosts available. + :vartype available_hosts: int + """ + + _validation = { + 'status': {'readonly': True}, + 'available_hosts': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'available_hosts': {'key': 'availableHosts', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(Trial, self).__init__(**kwargs) + self.status = None + self.available_hosts = None + + +class WorkloadNetworkDhcp(ProxyResource): + """NSX DHCP. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param properties: DHCP properties. + :type properties: ~azure.mgmt.avs.models.WorkloadNetworkDhcpEntity + """ + + _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'}, + 'properties': {'key': 'properties', 'type': 'WorkloadNetworkDhcpEntity'}, + } + + def __init__( + self, + *, + properties: Optional["WorkloadNetworkDhcpEntity"] = None, + **kwargs + ): + super(WorkloadNetworkDhcp, self).__init__(**kwargs) + self.properties = properties + + +class WorkloadNetworkDhcpEntity(msrest.serialization.Model): + """Base class for WorkloadNetworkDhcpServer and WorkloadNetworkDhcpRelay to inherit from. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: WorkloadNetworkDhcpRelay, WorkloadNetworkDhcpServer. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param dhcp_type: Required. Type of DHCP: SERVER or RELAY.Constant filled by server. Possible + values include: "SERVER", "RELAY". + :type dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum + :param display_name: Display name of the DHCP entity. + :type display_name: str + :ivar segments: NSX Segments consuming DHCP. + :vartype segments: list[str] + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState + :param revision: NSX revision number. + :type revision: long + """ + + _validation = { + 'dhcp_type': {'required': True}, + 'segments': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'dhcp_type': {'key': 'dhcpType', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'segments': {'key': 'segments', 'type': '[str]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'revision': {'key': 'revision', 'type': 'long'}, + } + + _subtype_map = { + 'dhcp_type': {'RELAY': 'WorkloadNetworkDhcpRelay', 'SERVER': 'WorkloadNetworkDhcpServer'} + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + revision: Optional[int] = None, + **kwargs + ): + super(WorkloadNetworkDhcpEntity, self).__init__(**kwargs) + self.dhcp_type = None # type: Optional[str] + self.display_name = display_name + self.segments = None + self.provisioning_state = None + self.revision = revision + + +class WorkloadNetworkDhcpList(msrest.serialization.Model): + """A list of NSX dhcp entities. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on the page. + :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkloadNetworkDhcp]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkDhcpList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class WorkloadNetworkDhcpRelay(WorkloadNetworkDhcpEntity): + """NSX DHCP Relay. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param dhcp_type: Required. Type of DHCP: SERVER or RELAY.Constant filled by server. Possible + values include: "SERVER", "RELAY". + :type dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum + :param display_name: Display name of the DHCP entity. + :type display_name: str + :ivar segments: NSX Segments consuming DHCP. + :vartype segments: list[str] + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState + :param revision: NSX revision number. + :type revision: long + :param server_addresses: DHCP Relay Addresses. Max 3. + :type server_addresses: list[str] + """ + + _validation = { + 'dhcp_type': {'required': True}, + 'segments': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'server_addresses': {'max_items': 3, 'min_items': 1}, + } + + _attribute_map = { + 'dhcp_type': {'key': 'dhcpType', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'segments': {'key': 'segments', 'type': '[str]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'revision': {'key': 'revision', 'type': 'long'}, + 'server_addresses': {'key': 'serverAddresses', 'type': '[str]'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + revision: Optional[int] = None, + server_addresses: Optional[List[str]] = None, + **kwargs + ): + super(WorkloadNetworkDhcpRelay, self).__init__(display_name=display_name, revision=revision, **kwargs) + self.dhcp_type = 'RELAY' # type: str + self.server_addresses = server_addresses + + +class WorkloadNetworkDhcpServer(WorkloadNetworkDhcpEntity): + """NSX DHCP Server. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param dhcp_type: Required. Type of DHCP: SERVER or RELAY.Constant filled by server. Possible + values include: "SERVER", "RELAY". + :type dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum + :param display_name: Display name of the DHCP entity. + :type display_name: str + :ivar segments: NSX Segments consuming DHCP. + :vartype segments: list[str] + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState + :param revision: NSX revision number. + :type revision: long + :param server_address: DHCP Server Address. + :type server_address: str + :param lease_time: DHCP Server Lease Time. + :type lease_time: long + """ + + _validation = { + 'dhcp_type': {'required': True}, + 'segments': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'dhcp_type': {'key': 'dhcpType', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'segments': {'key': 'segments', 'type': '[str]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'revision': {'key': 'revision', 'type': 'long'}, + 'server_address': {'key': 'serverAddress', 'type': 'str'}, + 'lease_time': {'key': 'leaseTime', 'type': 'long'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + revision: Optional[int] = None, + server_address: Optional[str] = None, + lease_time: Optional[int] = None, + **kwargs + ): + super(WorkloadNetworkDhcpServer, self).__init__(display_name=display_name, revision=revision, **kwargs) + self.dhcp_type = 'SERVER' # type: str + self.server_address = server_address + self.lease_time = lease_time + + +class WorkloadNetworkDnsService(ProxyResource): + """NSX DNS Service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: Display name of the DNS Service. + :type display_name: str + :param dns_service_ip: DNS service IP of the DNS Service. + :type dns_service_ip: str + :param default_dns_zone: Default DNS zone of the DNS Service. + :type default_dns_zone: str + :param fqdn_zones: FQDN zones of the DNS Service. + :type fqdn_zones: list[str] + :param log_level: DNS Service log level. Possible values include: "DEBUG", "INFO", "WARNING", + "ERROR", "FATAL". + :type log_level: str or ~azure.mgmt.avs.models.DnsServiceLogLevelEnum + :ivar status: DNS Service status. Possible values include: "SUCCESS", "FAILURE". + :vartype status: str or ~azure.mgmt.avs.models.DnsServiceStatusEnum + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.avs.models.WorkloadNetworkDnsServiceProvisioningState + :param revision: NSX revision number. + :type revision: long + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'dns_service_ip': {'key': 'properties.dnsServiceIp', 'type': 'str'}, + 'default_dns_zone': {'key': 'properties.defaultDnsZone', 'type': 'str'}, + 'fqdn_zones': {'key': 'properties.fqdnZones', 'type': '[str]'}, + 'log_level': {'key': 'properties.logLevel', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'revision': {'key': 'properties.revision', 'type': 'long'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + dns_service_ip: Optional[str] = None, + default_dns_zone: Optional[str] = None, + fqdn_zones: Optional[List[str]] = None, + log_level: Optional[Union[str, "DnsServiceLogLevelEnum"]] = None, + revision: Optional[int] = None, + **kwargs + ): + super(WorkloadNetworkDnsService, self).__init__(**kwargs) + self.display_name = display_name + self.dns_service_ip = dns_service_ip + self.default_dns_zone = default_dns_zone + self.fqdn_zones = fqdn_zones + self.log_level = log_level + self.status = None + self.provisioning_state = None + self.revision = revision + + +class WorkloadNetworkDnsServicesList(msrest.serialization.Model): + """A list of NSX DNS Services. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on the page. + :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkDnsService] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkloadNetworkDnsService]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkDnsServicesList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class WorkloadNetworkDnsZone(ProxyResource): + """NSX DNS Zone. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: Display name of the DNS Zone. + :type display_name: str + :param domain: Domain names of the DNS Zone. + :type domain: list[str] + :param dns_server_ips: DNS Server IP array of the DNS Zone. + :type dns_server_ips: list[str] + :param source_ip: Source IP of the DNS Zone. + :type source_ip: str + :param dns_services: Number of DNS Services using the DNS zone. + :type dns_services: long + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.avs.models.WorkloadNetworkDnsZoneProvisioningState + :param revision: NSX revision number. + :type revision: long + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'domain': {'key': 'properties.domain', 'type': '[str]'}, + 'dns_server_ips': {'key': 'properties.dnsServerIps', 'type': '[str]'}, + 'source_ip': {'key': 'properties.sourceIp', 'type': 'str'}, + 'dns_services': {'key': 'properties.dnsServices', 'type': 'long'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'revision': {'key': 'properties.revision', 'type': 'long'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + domain: Optional[List[str]] = None, + dns_server_ips: Optional[List[str]] = None, + source_ip: Optional[str] = None, + dns_services: Optional[int] = None, + revision: Optional[int] = None, + **kwargs + ): + super(WorkloadNetworkDnsZone, self).__init__(**kwargs) + self.display_name = display_name + self.domain = domain + self.dns_server_ips = dns_server_ips + self.source_ip = source_ip + self.dns_services = dns_services + self.provisioning_state = None + self.revision = revision + + +class WorkloadNetworkDnsZonesList(msrest.serialization.Model): + """A list of NSX DNS Zones. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on the page. + :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkloadNetworkDnsZone]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkDnsZonesList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class WorkloadNetworkGateway(ProxyResource): + """NSX Gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: Display name of the DHCP entity. + :type display_name: str + :ivar path: NSX Gateway Path. + :vartype path: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'path': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'path': {'key': 'properties.path', 'type': 'str'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + **kwargs + ): + super(WorkloadNetworkGateway, self).__init__(**kwargs) + self.display_name = display_name + self.path = None + + +class WorkloadNetworkGatewayList(msrest.serialization.Model): + """A list of NSX Gateways. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on the page. + :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkGateway] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkloadNetworkGateway]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkGatewayList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class WorkloadNetworkPortMirroring(ProxyResource): + """NSX Port Mirroring. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: Display name of the port mirroring profile. + :type display_name: str + :param direction: Direction of port mirroring profile. Possible values include: "INGRESS, + EGRESS, BIDIRECTIONAL". + :type direction: str or ~azure.mgmt.avs.models.PortMirroringDirectionEnum + :param source: Source VM Group. + :type source: str + :param destination: Destination VM Group. + :type destination: str + :ivar status: Port Mirroring Status. Possible values include: "SUCCESS, FAILURE". + :vartype status: str or ~azure.mgmt.avs.models.PortMirroringStatusEnum + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.avs.models.WorkloadNetworkPortMirroringProvisioningState + :param revision: NSX revision number. + :type revision: long + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'destination': {'key': 'properties.destination', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'revision': {'key': 'properties.revision', 'type': 'long'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + direction: Optional[Union[str, "PortMirroringDirectionEnum"]] = None, + source: Optional[str] = None, + destination: Optional[str] = None, + revision: Optional[int] = None, + **kwargs + ): + super(WorkloadNetworkPortMirroring, self).__init__(**kwargs) + self.display_name = display_name + self.direction = direction + self.source = source + self.destination = destination + self.status = None + self.provisioning_state = None + self.revision = revision + + +class WorkloadNetworkPortMirroringList(msrest.serialization.Model): + """A list of NSX Port Mirroring. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on the page. + :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkloadNetworkPortMirroring]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkPortMirroringList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class WorkloadNetworkPublicIP(ProxyResource): + """NSX Public IP Block. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: Display name of the Public IP Block. + :type display_name: str + :param number_of_public_i_ps: Number of Public IPs requested. + :type number_of_public_i_ps: long + :ivar public_ip_block: CIDR Block of the Public IP Block. + :vartype public_ip_block: str + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.avs.models.WorkloadNetworkPublicIPProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'public_ip_block': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'number_of_public_i_ps': {'key': 'properties.numberOfPublicIPs', 'type': 'long'}, + 'public_ip_block': {'key': 'properties.publicIPBlock', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + number_of_public_i_ps: Optional[int] = None, + **kwargs + ): + super(WorkloadNetworkPublicIP, self).__init__(**kwargs) + self.display_name = display_name + self.number_of_public_i_ps = number_of_public_i_ps + self.public_ip_block = None + self.provisioning_state = None + + +class WorkloadNetworkPublicIPsList(msrest.serialization.Model): + """A list of NSX Public IP Blocks. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on the page. + :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkloadNetworkPublicIP]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkPublicIPsList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class WorkloadNetworkSegment(ProxyResource): + """NSX Segment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: Display name of the segment. + :type display_name: str + :param connected_gateway: Gateway which to connect segment to. + :type connected_gateway: str + :param subnet: Subnet which to connect segment to. + :type subnet: ~azure.mgmt.avs.models.WorkloadNetworkSegmentSubnet + :ivar port_vif: Port Vif which segment is associated with. + :vartype port_vif: list[~azure.mgmt.avs.models.WorkloadNetworkSegmentPortVif] + :ivar status: Segment status. Possible values include: "SUCCESS, FAILURE". + :vartype status: str or ~azure.mgmt.avs.models.SegmentStatusEnum + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.avs.models.WorkloadNetworkSegmentProvisioningState + :param revision: NSX revision number. + :type revision: long + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'port_vif': {'readonly': True}, + 'status': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'connected_gateway': {'key': 'properties.connectedGateway', 'type': 'str'}, + 'subnet': {'key': 'properties.subnet', 'type': 'WorkloadNetworkSegmentSubnet'}, + 'port_vif': {'key': 'properties.portVif', 'type': '[WorkloadNetworkSegmentPortVif]'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'revision': {'key': 'properties.revision', 'type': 'long'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + connected_gateway: Optional[str] = None, + subnet: Optional["WorkloadNetworkSegmentSubnet"] = None, + revision: Optional[int] = None, + **kwargs + ): + super(WorkloadNetworkSegment, self).__init__(**kwargs) + self.display_name = display_name + self.connected_gateway = connected_gateway + self.subnet = subnet + self.port_vif = None + self.status = None + self.provisioning_state = None + self.revision = revision + + +class WorkloadNetworkSegmentPortVif(msrest.serialization.Model): + """Ports and any VIF attached to segment. + + :param port_name: Name of port or VIF attached to segment. + :type port_name: str + """ + + _attribute_map = { + 'port_name': {'key': 'portName', 'type': 'str'}, + } + + def __init__( + self, + *, + port_name: Optional[str] = None, + **kwargs + ): + super(WorkloadNetworkSegmentPortVif, self).__init__(**kwargs) + self.port_name = port_name + + +class WorkloadNetworkSegmentsList(msrest.serialization.Model): + """A list of NSX Segments. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on the page. + :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkloadNetworkSegment]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkSegmentsList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class WorkloadNetworkSegmentSubnet(msrest.serialization.Model): + """Subnet configuration for segment. + + :param dhcp_ranges: DHCP Range assigned for subnet. + :type dhcp_ranges: list[str] + :param gateway_address: Gateway address. + :type gateway_address: str + """ + + _attribute_map = { + 'dhcp_ranges': {'key': 'dhcpRanges', 'type': '[str]'}, + 'gateway_address': {'key': 'gatewayAddress', 'type': 'str'}, + } + + def __init__( + self, + *, + dhcp_ranges: Optional[List[str]] = None, + gateway_address: Optional[str] = None, + **kwargs + ): + super(WorkloadNetworkSegmentSubnet, self).__init__(**kwargs) + self.dhcp_ranges = dhcp_ranges + self.gateway_address = gateway_address + + +class WorkloadNetworkVirtualMachine(ProxyResource): + """NSX Virtual Machine. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: Display name of the VM. + :type display_name: str + :ivar vm_type: Virtual machine type. Possible values include: "REGULAR, EDGE, SERVICE". + :vartype vm_type: str or ~azure.mgmt.avs.models.VMTypeEnum + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'vm_type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'vm_type': {'key': 'properties.vmType', 'type': 'str'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + **kwargs + ): + super(WorkloadNetworkVirtualMachine, self).__init__(**kwargs) + self.display_name = display_name + self.vm_type = None + + +class WorkloadNetworkVirtualMachinesList(msrest.serialization.Model): + """A list of NSX Virtual Machines. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on the page. + :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkloadNetworkVirtualMachine]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkVirtualMachinesList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class WorkloadNetworkVMGroup(ProxyResource): + """NSX VM Group. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: Display name of the VM group. + :type display_name: str + :param members: Virtual machine members of this group. + :type members: list[str] + :ivar status: VM Group status. Possible values include: "SUCCESS, FAILURE". + :vartype status: str or ~azure.mgmt.avs.models.VMGroupStatusEnum + :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", + "Failed", "Building", "Deleting", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.avs.models.WorkloadNetworkVMGroupProvisioningState + :param revision: NSX revision number. + :type revision: long + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'members': {'key': 'properties.members', 'type': '[str]'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'revision': {'key': 'properties.revision', 'type': 'long'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + members: Optional[List[str]] = None, + revision: Optional[int] = None, + **kwargs + ): + super(WorkloadNetworkVMGroup, self).__init__(**kwargs) + self.display_name = display_name + self.members = members + self.status = None + self.provisioning_state = None + self.revision = revision + + +class WorkloadNetworkVMGroupsList(msrest.serialization.Model): + """A list of NSX VM Groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The items on the page. + :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :ivar next_link: URL to get the next page if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WorkloadNetworkVMGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkloadNetworkVMGroupsList, self).__init__(**kwargs) + self.value = None + self.next_link = None diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/__init__.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/__init__.py new file mode 100644 index 000000000000..1e3c208eb0fd --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/__init__.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._locations_operations import LocationsOperations +from ._private_clouds_operations import PrivateCloudsOperations +from ._clusters_operations import ClustersOperations +from ._datastores_operations import DatastoresOperations +from ._hcx_enterprise_sites_operations import HcxEnterpriseSitesOperations +from ._authorizations_operations import AuthorizationsOperations +from ._global_reach_connections_operations import GlobalReachConnectionsOperations +from ._workload_networks_operations import WorkloadNetworksOperations +from ._cloud_links_operations import CloudLinksOperations +from ._addons_operations import AddonsOperations +from ._script_packages_operations import ScriptPackagesOperations +from ._script_cmdlets_operations import ScriptCmdletsOperations +from ._script_executions_operations import ScriptExecutionsOperations + +__all__ = [ + 'Operations', + 'LocationsOperations', + 'PrivateCloudsOperations', + 'ClustersOperations', + 'DatastoresOperations', + 'HcxEnterpriseSitesOperations', + 'AuthorizationsOperations', + 'GlobalReachConnectionsOperations', + 'WorkloadNetworksOperations', + 'CloudLinksOperations', + 'AddonsOperations', + 'ScriptPackagesOperations', + 'ScriptCmdletsOperations', + 'ScriptExecutionsOperations', +] diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_addons_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_addons_operations.py new file mode 100644 index 000000000000..cbf11fb1c6b1 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_addons_operations.py @@ -0,0 +1,448 @@ +# 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 AddonsOperations(object): + """AddonsOperations 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.avs.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 list( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AddonList"] + """List addons in a private cloud. + + List addons in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AddonList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.AddonList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AddonList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('AddonList', 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.AVS/privateClouds/{privateCloudName}/addons'} # type: ignore + + def get( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + addon_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Addon" + """Get an addon by name in a private cloud. + + Get an addon by name in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param addon_name: Name of the addon for the private cloud. + :type addon_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Addon, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.Addon + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'addonName': self._serialize.url("addon_name", addon_name, '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('Addon', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + addon_name, # type: str + addon, # type: "_models.Addon" + **kwargs # type: Any + ): + # type: (...) -> "_models.Addon" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'addonName': self._serialize.url("addon_name", addon_name, '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['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(addon, 'Addon') + 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('Addon', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Addon', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + addon_name, # type: str + addon, # type: "_models.Addon" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Addon"] + """Create or update a addon in a private cloud. + + Create or update a addon in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: The name of the private cloud. + :type private_cloud_name: str + :param addon_name: Name of the addon for the private cloud. + :type addon_name: str + :param addon: A addon in the private cloud. + :type addon: ~azure.mgmt.avs.models.Addon + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Addon or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Addon] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] + 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_cloud_name=private_cloud_name, + addon_name=addon_name, + addon=addon, + 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('Addon', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'addonName': self._serialize.url("addon_name", addon_name, '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.AVS/privateClouds/{privateCloudName}/addons/{addonName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + addon_name, # type: 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'addonName': self._serialize.url("addon_name", addon_name, '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.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.AVS/privateClouds/{privateCloudName}/addons/{addonName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + addon_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete a addon in a private cloud. + + Delete a addon in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param addon_name: Name of the addon for the private cloud. + :type addon_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_cloud_name=private_cloud_name, + addon_name=addon_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'addonName': self._serialize.url("addon_name", addon_name, '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.AVS/privateClouds/{privateCloudName}/addons/{addonName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_authorizations_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_authorizations_operations.py new file mode 100644 index 000000000000..ef131b290e4c --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_authorizations_operations.py @@ -0,0 +1,448 @@ +# 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 AuthorizationsOperations(object): + """AuthorizationsOperations 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.avs.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 list( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ExpressRouteAuthorizationList"] + """List ExpressRoute Circuit Authorizations in a private cloud. + + List ExpressRoute Circuit Authorizations in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRouteAuthorizationList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.ExpressRouteAuthorizationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExpressRouteAuthorizationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('ExpressRouteAuthorizationList', 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.AVS/privateClouds/{privateCloudName}/authorizations'} # type: ignore + + def get( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + authorization_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ExpressRouteAuthorization" + """Get an ExpressRoute Circuit Authorization by name in a private cloud. + + Get an ExpressRoute Circuit Authorization by name in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud. + :type authorization_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteAuthorization, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.ExpressRouteAuthorization + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExpressRouteAuthorization"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'authorizationName': self._serialize.url("authorization_name", authorization_name, '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('ExpressRouteAuthorization', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + authorization_name, # type: str + authorization, # type: "_models.ExpressRouteAuthorization" + **kwargs # type: Any + ): + # type: (...) -> "_models.ExpressRouteAuthorization" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExpressRouteAuthorization"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'authorizationName': self._serialize.url("authorization_name", authorization_name, '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['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(authorization, 'ExpressRouteAuthorization') + 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('ExpressRouteAuthorization', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteAuthorization', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + authorization_name, # type: str + authorization, # type: "_models.ExpressRouteAuthorization" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ExpressRouteAuthorization"] + """Create or update an ExpressRoute Circuit Authorization in a private cloud. + + Create or update an ExpressRoute Circuit Authorization in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: The name of the private cloud. + :type private_cloud_name: str + :param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud. + :type authorization_name: str + :param authorization: An ExpressRoute Circuit Authorization. + :type authorization: ~azure.mgmt.avs.models.ExpressRouteAuthorization + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ExpressRouteAuthorization or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExpressRouteAuthorization"] + 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_cloud_name=private_cloud_name, + authorization_name=authorization_name, + authorization=authorization, + 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('ExpressRouteAuthorization', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'authorizationName': self._serialize.url("authorization_name", authorization_name, '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.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + authorization_name, # type: 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'authorizationName': self._serialize.url("authorization_name", authorization_name, '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.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.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + authorization_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete an ExpressRoute Circuit Authorization in a private cloud. + + Delete an ExpressRoute Circuit Authorization in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud. + :type authorization_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_cloud_name=private_cloud_name, + authorization_name=authorization_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'authorizationName': self._serialize.url("authorization_name", authorization_name, '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.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_cloud_links_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_cloud_links_operations.py new file mode 100644 index 000000000000..7f8d7c545008 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_cloud_links_operations.py @@ -0,0 +1,448 @@ +# 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 CloudLinksOperations(object): + """CloudLinksOperations 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.avs.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 list( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CloudLinkList"] + """List cloud link in a private cloud. + + List cloud link in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CloudLinkList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.CloudLinkList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudLinkList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('CloudLinkList', 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.AVS/privateClouds/{privateCloudName}/cloudLinks'} # type: ignore + + def get( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + cloud_link_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CloudLink" + """Get an cloud link by name in a private cloud. + + Get an cloud link by name in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param cloud_link_name: Name of the cloud link resource. + :type cloud_link_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CloudLink, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.CloudLink + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudLink"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'cloudLinkName': self._serialize.url("cloud_link_name", cloud_link_name, '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('CloudLink', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + cloud_link_name, # type: str + cloud_link, # type: "_models.CloudLink" + **kwargs # type: Any + ): + # type: (...) -> "_models.CloudLink" + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudLink"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'cloudLinkName': self._serialize.url("cloud_link_name", cloud_link_name, '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['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(cloud_link, 'CloudLink') + 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('CloudLink', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CloudLink', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + cloud_link_name, # type: str + cloud_link, # type: "_models.CloudLink" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CloudLink"] + """Create or update a cloud link in a private cloud. + + Create or update a cloud link in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: The name of the private cloud. + :type private_cloud_name: str + :param cloud_link_name: Name of the cloud link resource. + :type cloud_link_name: str + :param cloud_link: A cloud link in the private cloud. + :type cloud_link: ~azure.mgmt.avs.models.CloudLink + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CloudLink or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.CloudLink] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudLink"] + 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_cloud_name=private_cloud_name, + cloud_link_name=cloud_link_name, + cloud_link=cloud_link, + 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('CloudLink', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'cloudLinkName': self._serialize.url("cloud_link_name", cloud_link_name, '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.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + cloud_link_name, # type: 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'cloudLinkName': self._serialize.url("cloud_link_name", cloud_link_name, '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.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.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + cloud_link_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete a cloud link in a private cloud. + + Delete a cloud link in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param cloud_link_name: Name of the cloud link resource. + :type cloud_link_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_cloud_name=private_cloud_name, + cloud_link_name=cloud_link_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'cloudLinkName': self._serialize.url("cloud_link_name", cloud_link_name, '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.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_clusters_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_clusters_operations.py new file mode 100644 index 000000000000..08a4a65e126f --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_clusters_operations.py @@ -0,0 +1,587 @@ +# 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 ClustersOperations(object): + """ClustersOperations 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.avs.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 list( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ClusterList"] + """List clusters in a private cloud. + + List clusters in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ClusterList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.ClusterList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('ClusterList', 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.AVS/privateClouds/{privateCloudName}/clusters'} # type: ignore + + def get( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Cluster" + """Get a cluster by name in a private cloud. + + Get a cluster by name in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param cluster_name: Name of the cluster in the private cloud. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Cluster, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.Cluster + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, '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('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + cluster_name, # type: str + cluster, # type: "_models.Cluster" + **kwargs # type: Any + ): + # type: (...) -> "_models.Cluster" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, '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['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(cluster, 'Cluster') + 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('Cluster', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + cluster_name, # type: str + cluster, # type: "_models.Cluster" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Cluster"] + """Create or update a cluster in a private cloud. + + Create or update a cluster in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: The name of the private cloud. + :type private_cloud_name: str + :param cluster_name: Name of the cluster in the private cloud. + :type cluster_name: str + :param cluster: A cluster in the private cloud. + :type cluster: ~azure.mgmt.avs.models.Cluster + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Cluster or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + 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_cloud_name=private_cloud_name, + cluster_name=cluster_name, + cluster=cluster, + 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('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, '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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + cluster_name, # type: str + cluster_update, # type: "_models.ClusterUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.Cluster" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, '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['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(cluster_update, 'ClusterUpdate') + 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, 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('Cluster', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + cluster_name, # type: str + cluster_update, # type: "_models.ClusterUpdate" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Cluster"] + """Update a cluster in a private cloud. + + Update a cluster in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param cluster_name: Name of the cluster in the private cloud. + :type cluster_name: str + :param cluster_update: The cluster properties to be updated. + :type cluster_update: ~azure.mgmt.avs.models.ClusterUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Cluster or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + 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_cloud_name=private_cloud_name, + cluster_name=cluster_name, + cluster_update=cluster_update, + 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('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, '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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + cluster_name, # type: 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, '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.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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete a cluster in a private cloud. + + Delete a cluster in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param cluster_name: Name of the cluster in the private cloud. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_cloud_name=private_cloud_name, + cluster_name=cluster_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, '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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_datastores_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_datastores_operations.py new file mode 100644 index 000000000000..5217ec4dc6f1 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_datastores_operations.py @@ -0,0 +1,470 @@ +# 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 DatastoresOperations(object): + """DatastoresOperations 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.avs.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 list( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DatastoreList"] + """List datastores in a private cloud cluster. + + List datastores in a private cloud cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param cluster_name: Name of the cluster in the private cloud. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatastoreList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.DatastoreList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatastoreList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, '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') + + 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('DatastoreList', 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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores'} # type: ignore + + def get( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + cluster_name, # type: str + datastore_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Datastore" + """Get a datastore in a private cloud cluster. + + Get a datastore in a private cloud cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param cluster_name: Name of the cluster in the private cloud. + :type cluster_name: str + :param datastore_name: Name of the datastore in the private cloud cluster. + :type datastore_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Datastore, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.Datastore + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Datastore"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'datastoreName': self._serialize.url("datastore_name", datastore_name, '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('Datastore', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + cluster_name, # type: str + datastore_name, # type: str + datastore, # type: "_models.Datastore" + **kwargs # type: Any + ): + # type: (...) -> "_models.Datastore" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Datastore"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'datastoreName': self._serialize.url("datastore_name", datastore_name, '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['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(datastore, 'Datastore') + 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('Datastore', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Datastore', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + cluster_name, # type: str + datastore_name, # type: str + datastore, # type: "_models.Datastore" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Datastore"] + """Create or update a datastore in a private cloud cluster. + + Create or update a datastore in a private cloud cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param cluster_name: Name of the cluster in the private cloud. + :type cluster_name: str + :param datastore_name: Name of the datastore in the private cloud cluster. + :type datastore_name: str + :param datastore: A datastore in a private cloud cluster. + :type datastore: ~azure.mgmt.avs.models.Datastore + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Datastore or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Datastore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Datastore"] + 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_cloud_name=private_cloud_name, + cluster_name=cluster_name, + datastore_name=datastore_name, + datastore=datastore, + 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('Datastore', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'datastoreName': self._serialize.url("datastore_name", datastore_name, '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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + cluster_name, # type: str + datastore_name, # type: 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'datastoreName': self._serialize.url("datastore_name", datastore_name, '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.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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + cluster_name, # type: str + datastore_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete a datastore in a private cloud cluster. + + Delete a datastore in a private cloud cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param cluster_name: Name of the cluster in the private cloud. + :type cluster_name: str + :param datastore_name: Name of the datastore in the private cloud cluster. + :type datastore_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_cloud_name=private_cloud_name, + cluster_name=cluster_name, + datastore_name=datastore_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'datastoreName': self._serialize.url("datastore_name", datastore_name, '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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_global_reach_connections_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_global_reach_connections_operations.py new file mode 100644 index 000000000000..a5b6e97ce621 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_global_reach_connections_operations.py @@ -0,0 +1,448 @@ +# 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 GlobalReachConnectionsOperations(object): + """GlobalReachConnectionsOperations 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.avs.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 list( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.GlobalReachConnectionList"] + """List global reach connections in a private cloud. + + List global reach connections in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GlobalReachConnectionList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.GlobalReachConnectionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GlobalReachConnectionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('GlobalReachConnectionList', 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.AVS/privateClouds/{privateCloudName}/globalReachConnections'} # type: ignore + + def get( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + global_reach_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.GlobalReachConnection" + """Get a global reach connection by name in a private cloud. + + Get a global reach connection by name in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param global_reach_connection_name: Name of the global reach connection in the private cloud. + :type global_reach_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GlobalReachConnection, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.GlobalReachConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GlobalReachConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'globalReachConnectionName': self._serialize.url("global_reach_connection_name", global_reach_connection_name, '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('GlobalReachConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + global_reach_connection_name, # type: str + global_reach_connection, # type: "_models.GlobalReachConnection" + **kwargs # type: Any + ): + # type: (...) -> "_models.GlobalReachConnection" + cls = kwargs.pop('cls', None) # type: ClsType["_models.GlobalReachConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'globalReachConnectionName': self._serialize.url("global_reach_connection_name", global_reach_connection_name, '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['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(global_reach_connection, 'GlobalReachConnection') + 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('GlobalReachConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GlobalReachConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + global_reach_connection_name, # type: str + global_reach_connection, # type: "_models.GlobalReachConnection" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.GlobalReachConnection"] + """Create or update a global reach connection in a private cloud. + + Create or update a global reach connection in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: The name of the private cloud. + :type private_cloud_name: str + :param global_reach_connection_name: Name of the global reach connection in the private cloud. + :type global_reach_connection_name: str + :param global_reach_connection: A global reach connection in the private cloud. + :type global_reach_connection: ~azure.mgmt.avs.models.GlobalReachConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either GlobalReachConnection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.GlobalReachConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GlobalReachConnection"] + 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_cloud_name=private_cloud_name, + global_reach_connection_name=global_reach_connection_name, + global_reach_connection=global_reach_connection, + 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('GlobalReachConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'globalReachConnectionName': self._serialize.url("global_reach_connection_name", global_reach_connection_name, '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.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + global_reach_connection_name, # type: 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'globalReachConnectionName': self._serialize.url("global_reach_connection_name", global_reach_connection_name, '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.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.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + global_reach_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete a global reach connection in a private cloud. + + Delete a global reach connection in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param global_reach_connection_name: Name of the global reach connection in the private cloud. + :type global_reach_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_cloud_name=private_cloud_name, + global_reach_connection_name=global_reach_connection_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'globalReachConnectionName': self._serialize.url("global_reach_connection_name", global_reach_connection_name, '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.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_hcx_enterprise_sites_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_hcx_enterprise_sites_operations.py new file mode 100644 index 000000000000..e4ff21f0d177 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_hcx_enterprise_sites_operations.py @@ -0,0 +1,327 @@ +# 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 HcxEnterpriseSitesOperations(object): + """HcxEnterpriseSitesOperations 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.avs.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 list( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.HcxEnterpriseSiteList"] + """List HCX Enterprise Sites in a private cloud. + + List HCX Enterprise Sites in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HcxEnterpriseSiteList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.HcxEnterpriseSiteList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HcxEnterpriseSiteList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('HcxEnterpriseSiteList', 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.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites'} # type: ignore + + def get( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + hcx_enterprise_site_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.HcxEnterpriseSite" + """Get an HCX Enterprise Site by name in a private cloud. + + Get an HCX Enterprise Site by name in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud. + :type hcx_enterprise_site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HcxEnterpriseSite, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HcxEnterpriseSite"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'hcxEnterpriseSiteName': self._serialize.url("hcx_enterprise_site_name", hcx_enterprise_site_name, '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('HcxEnterpriseSite', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + hcx_enterprise_site_name, # type: str + hcx_enterprise_site, # type: "_models.HcxEnterpriseSite" + **kwargs # type: Any + ): + # type: (...) -> "_models.HcxEnterpriseSite" + """Create or update an HCX Enterprise Site in a private cloud. + + Create or update an HCX Enterprise Site in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: The name of the private cloud. + :type private_cloud_name: str + :param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud. + :type hcx_enterprise_site_name: str + :param hcx_enterprise_site: The HCX Enterprise Site. + :type hcx_enterprise_site: ~azure.mgmt.avs.models.HcxEnterpriseSite + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HcxEnterpriseSite, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HcxEnterpriseSite"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'hcxEnterpriseSiteName': self._serialize.url("hcx_enterprise_site_name", hcx_enterprise_site_name, '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['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(hcx_enterprise_site, 'HcxEnterpriseSite') + 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('HcxEnterpriseSite', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('HcxEnterpriseSite', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + hcx_enterprise_site_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete an HCX Enterprise Site in a private cloud. + + Delete an HCX Enterprise Site in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud. + :type hcx_enterprise_site_name: 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'hcxEnterpriseSiteName': self._serialize.url("hcx_enterprise_site_name", hcx_enterprise_site_name, '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.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.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_locations_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_locations_operations.py new file mode 100644 index 000000000000..b782fc85d1d5 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_locations_operations.py @@ -0,0 +1,155 @@ +# 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.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, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class LocationsOperations(object): + """LocationsOperations 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.avs.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 check_trial_availability( + self, + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Trial" + """Return trial status for subscription by region. + + :param location: Azure region. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Trial, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.Trial + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Trial"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.check_trial_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'location': self._serialize.url("location", location, '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.post(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('Trial', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_trial_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability'} # type: ignore + + def check_quota_availability( + self, + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Quota" + """Return quota for subscription by region. + + :param location: Azure region. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Quota, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.Quota + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Quota"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.check_quota_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'location': self._serialize.url("location", location, '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.post(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('Quota', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_quota_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_operations.py new file mode 100644 index 000000000000..61ca34137e14 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_operations.py @@ -0,0 +1,109 @@ +# 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 + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations 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.avs.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 list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationList"] + """Lists all of the available operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.OperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + 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('OperationList', 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': '/providers/Microsoft.AVS/operations'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_private_clouds_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_private_clouds_operations.py new file mode 100644 index 000000000000..30894a5616a9 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_private_clouds_operations.py @@ -0,0 +1,912 @@ +# 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 PrivateCloudsOperations(object): + """PrivateCloudsOperations 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.avs.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 list( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateCloudList"] + """List private clouds in a resource group. + + List private clouds in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateCloudList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.PrivateCloudList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateCloudList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + 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') + + 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('PrivateCloudList', 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.AVS/privateClouds'} # type: ignore + + def list_in_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateCloudList"] + """List private clouds in a subscription. + + List private clouds in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateCloudList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.PrivateCloudList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateCloudList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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_in_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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') + + 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('PrivateCloudList', 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_in_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds'} # type: ignore + + def get( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateCloud" + """Get a private cloud. + + Get a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateCloud, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.PrivateCloud + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateCloud"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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('PrivateCloud', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + private_cloud, # type: "_models.PrivateCloud" + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateCloud" + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateCloud"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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['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(private_cloud, 'PrivateCloud') + 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('PrivateCloud', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateCloud', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + private_cloud, # type: "_models.PrivateCloud" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.PrivateCloud"] + """Create or update a private cloud. + + Create or update a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param private_cloud: The private cloud. + :type private_cloud: ~azure.mgmt.avs.models.PrivateCloud + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateCloud or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateCloud"] + 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_cloud_name=private_cloud_name, + private_cloud=private_cloud, + 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('PrivateCloud', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.AVS/privateClouds/{privateCloudName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + private_cloud_update, # type: "_models.PrivateCloudUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateCloud" + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateCloud"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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['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(private_cloud_update, 'PrivateCloudUpdate') + 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, 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('PrivateCloud', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateCloud', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + private_cloud_update, # type: "_models.PrivateCloudUpdate" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.PrivateCloud"] + """Update a private cloud. + + Update a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param private_cloud_update: The private cloud properties to be updated. + :type private_cloud_update: ~azure.mgmt.avs.models.PrivateCloudUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateCloud or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateCloud"] + 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_cloud_name=private_cloud_name, + private_cloud_update=private_cloud_update, + 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('PrivateCloud', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.AVS/privateClouds/{privateCloudName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.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.AVS/privateClouds/{privateCloudName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete a private cloud. + + Delete a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_cloud_name=private_cloud_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.AVS/privateClouds/{privateCloudName}'} # type: ignore + + def _rotate_vcenter_password_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._rotate_vcenter_password_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.post(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 [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, {}) + + _rotate_vcenter_password_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword'} # type: ignore + + def begin_rotate_vcenter_password( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Rotate the vCenter password. + + Rotate the vCenter password. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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._rotate_vcenter_password_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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_rotate_vcenter_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword'} # type: ignore + + def _rotate_nsxt_password_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._rotate_nsxt_password_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.post(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 [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, {}) + + _rotate_nsxt_password_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword'} # type: ignore + + def begin_rotate_nsxt_password( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Rotate the NSX-T Manager password. + + Rotate the NSX-T Manager password. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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._rotate_nsxt_password_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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_rotate_nsxt_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword'} # type: ignore + + def list_admin_credentials( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AdminCredentials" + """List the admin credentials for the private cloud. + + List the admin credentials for the private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AdminCredentials, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.AdminCredentials + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AdminCredentials"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.list_admin_credentials.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.post(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('AdminCredentials', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_admin_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/listAdminCredentials'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_cmdlets_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_cmdlets_operations.py new file mode 100644 index 000000000000..aeffe771edf1 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_cmdlets_operations.py @@ -0,0 +1,194 @@ +# 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 + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ScriptCmdletsOperations(object): + """ScriptCmdletsOperations 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.avs.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 list( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + script_package_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ScriptCmdletsList"] + """Return script cmdlet resources available for a private cloud to create a script execution + resource on their Private Cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param script_package_name: Name of the script package in the private cloud. + :type script_package_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScriptCmdletsList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.ScriptCmdletsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptCmdletsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'scriptPackageName': self._serialize.url("script_package_name", script_package_name, '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') + + 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('ScriptCmdletsList', 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.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets'} # type: ignore + + def get( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + script_package_name, # type: str + script_cmdlet_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ScriptCmdlet" + """Return information about a script cmdlet resource in a specific package on a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param script_package_name: Name of the script package in the private cloud. + :type script_package_name: str + :param script_cmdlet_name: Name of the script cmdlet resource in the script package in the + private cloud. + :type script_cmdlet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScriptCmdlet, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.ScriptCmdlet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptCmdlet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'scriptPackageName': self._serialize.url("script_package_name", script_package_name, 'str'), + 'scriptCmdletName': self._serialize.url("script_cmdlet_name", script_cmdlet_name, '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('ScriptCmdlet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets/{scriptCmdletName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_executions_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_executions_operations.py new file mode 100644 index 000000000000..89aaea947a75 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_executions_operations.py @@ -0,0 +1,523 @@ +# 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, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ScriptExecutionsOperations(object): + """ScriptExecutionsOperations 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.avs.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 list( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ScriptExecutionsList"] + """Get an script execution resource by name in a private cloud. + + Get an script execution resource by name in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScriptExecutionsList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.ScriptExecutionsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptExecutionsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('ScriptExecutionsList', 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.AVS/privateClouds/{privateCloudName}/scriptExecutions'} # type: ignore + + def get( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + script_execution_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ScriptExecution" + """Get an script execution resource by name in a private cloud. + + Get an script execution resource by name in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param script_execution_name: Name of the user-invoked script execution resource. + :type script_execution_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScriptExecution, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.ScriptExecution + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptExecution"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, '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('ScriptExecution', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + script_execution_name, # type: str + script_execution, # type: "_models.ScriptExecution" + **kwargs # type: Any + ): + # type: (...) -> "_models.ScriptExecution" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptExecution"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, '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['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(script_execution, 'ScriptExecution') + 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('ScriptExecution', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ScriptExecution', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + script_execution_name, # type: str + script_execution, # type: "_models.ScriptExecution" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ScriptExecution"] + """Create or update a script execution resource in a private cloud. + + Create or update a script execution resource in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: The name of the private cloud. + :type private_cloud_name: str + :param script_execution_name: Name of the user-invoked script execution resource. + :type script_execution_name: str + :param script_execution: A script running in the private cloud. + :type script_execution: ~azure.mgmt.avs.models.ScriptExecution + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ScriptExecution or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ScriptExecution] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptExecution"] + 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_cloud_name=private_cloud_name, + script_execution_name=script_execution_name, + script_execution=script_execution, + 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('ScriptExecution', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, '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.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + script_execution_name, # type: 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, '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.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.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + script_execution_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Cancel a ScriptExecution in a private cloud. + + Cancel a ScriptExecution in a private cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param script_execution_name: Name of the user-invoked script execution resource. + :type script_execution_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_cloud_name=private_cloud_name, + script_execution_name=script_execution_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, '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.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}'} # type: ignore + + def get_execution_logs( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + script_execution_name, # type: str + script_output_stream_type=None, # type: Optional[List[Union[str, "_models.ScriptOutputStreamType"]]] + **kwargs # type: Any + ): + # type: (...) -> "_models.ScriptExecution" + """Return the logs for a script execution resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param script_execution_name: Name of the user-invoked script execution resource. + :type script_execution_name: str + :param script_output_stream_type: Name of the desired output stream to return. If not provided, + will return all. An empty array will return nothing. + :type script_output_stream_type: list[str or ~azure.mgmt.avs.models.ScriptOutputStreamType] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScriptExecution, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.ScriptExecution + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptExecution"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.get_execution_logs.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, '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['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] + if script_output_stream_type is not None: + body_content = self._serialize.body(script_output_stream_type, '[str]') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(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('ScriptExecution', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_execution_logs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}/getExecutionLogs'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_packages_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_packages_operations.py new file mode 100644 index 000000000000..910b857c7a36 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_packages_operations.py @@ -0,0 +1,184 @@ +# 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 + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ScriptPackagesOperations(object): + """ScriptPackagesOperations 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.avs.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 list( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ScriptPackagesList"] + """Return script packages available for a private cloud to run on their Private Cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScriptPackagesList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.ScriptPackagesList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptPackagesList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('ScriptPackagesList', 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.AVS/privateClouds/{privateCloudName}/scriptPackages'} # type: ignore + + def get( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + script_package_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ScriptPackage" + """Return script package available to run on an Private Cloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param script_package_name: Name of the script package in the private cloud. + :type script_package_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScriptPackage, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.ScriptPackage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptPackage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'scriptPackageName': self._serialize.url("script_package_name", script_package_name, '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('ScriptPackage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_workload_networks_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_workload_networks_operations.py new file mode 100644 index 000000000000..5ce42cfd67e4 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_workload_networks_operations.py @@ -0,0 +1,3965 @@ +# 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 WorkloadNetworksOperations(object): + """WorkloadNetworksOperations 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.avs.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 list_segments( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.WorkloadNetworkSegmentsList"] + """List of segments in a private cloud workload network. + + List of segments in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkloadNetworkSegmentsList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkSegmentsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkSegmentsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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_segments.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('WorkloadNetworkSegmentsList', 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_segments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments'} # type: ignore + + def get_segment( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + segment_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.WorkloadNetworkSegment" + """Get a segment by id in a private cloud workload network. + + Get a segment by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. + :type segment_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkloadNetworkSegment, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkSegment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkSegment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get_segment.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'segmentId': self._serialize.url("segment_id", segment_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('WorkloadNetworkSegment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_segment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + + def _create_segments_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + segment_id, # type: str + workload_network_segment, # type: "_models.WorkloadNetworkSegment" + **kwargs # type: Any + ): + # type: (...) -> "_models.WorkloadNetworkSegment" + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkSegment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_segments_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'segmentId': self._serialize.url("segment_id", segment_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['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(workload_network_segment, 'WorkloadNetworkSegment') + 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('WorkloadNetworkSegment', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WorkloadNetworkSegment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_segments_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + + def begin_create_segments( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + segment_id, # type: str + workload_network_segment, # type: "_models.WorkloadNetworkSegment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.WorkloadNetworkSegment"] + """Create a segment by id in a private cloud workload network. + + Create a segment by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. + :type segment_id: str + :param workload_network_segment: NSX Segment. + :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkSegment"] + 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_segments_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + segment_id=segment_id, + workload_network_segment=workload_network_segment, + 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('WorkloadNetworkSegment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'segmentId': self._serialize.url("segment_id", segment_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_segments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + + def _update_segments_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + segment_id, # type: str + workload_network_segment, # type: "_models.WorkloadNetworkSegment" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.WorkloadNetworkSegment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WorkloadNetworkSegment"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_segments_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'segmentId': self._serialize.url("segment_id", segment_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['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(workload_network_segment, 'WorkloadNetworkSegment') + 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('WorkloadNetworkSegment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_segments_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + + def begin_update_segments( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + segment_id, # type: str + workload_network_segment, # type: "_models.WorkloadNetworkSegment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.WorkloadNetworkSegment"] + """Create or update a segment by id in a private cloud workload network. + + Create or update a segment by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. + :type segment_id: str + :param workload_network_segment: NSX Segment. + :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkSegment"] + 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_segments_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + segment_id=segment_id, + workload_network_segment=workload_network_segment, + 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('WorkloadNetworkSegment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'segmentId': self._serialize.url("segment_id", segment_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_segments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + + def _delete_segment_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + segment_id, # type: 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_segment_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'segmentId': self._serialize.url("segment_id", segment_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.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_segment_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + + def begin_delete_segment( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + segment_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete a segment by id in a private cloud workload network. + + Delete a segment by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. + :type segment_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_segment_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + segment_id=segment_id, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'segmentId': self._serialize.url("segment_id", segment_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_segment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + + def list_dhcp( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.WorkloadNetworkDhcpList"] + """List dhcp in a private cloud workload network. + + List dhcp in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkloadNetworkDhcpList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDhcpList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDhcpList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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_dhcp.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('WorkloadNetworkDhcpList', 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_dhcp.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations'} # type: ignore + + def get_dhcp( + self, + resource_group_name, # type: str + dhcp_id, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.WorkloadNetworkDhcp" + """Get dhcp by id in a private cloud workload network. + + Get dhcp by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. + :type dhcp_id: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkloadNetworkDhcp, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkDhcp + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDhcp"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get_dhcp.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dhcpId': self._serialize.url("dhcp_id", dhcp_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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('WorkloadNetworkDhcp', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_dhcp.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + + def _create_dhcp_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + dhcp_id, # type: str + workload_network_dhcp, # type: "_models.WorkloadNetworkDhcp" + **kwargs # type: Any + ): + # type: (...) -> "_models.WorkloadNetworkDhcp" + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDhcp"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_dhcp_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dhcpId': self._serialize.url("dhcp_id", dhcp_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['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(workload_network_dhcp, 'WorkloadNetworkDhcp') + 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('WorkloadNetworkDhcp', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WorkloadNetworkDhcp', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_dhcp_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + + def begin_create_dhcp( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + dhcp_id, # type: str + workload_network_dhcp, # type: "_models.WorkloadNetworkDhcp" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.WorkloadNetworkDhcp"] + """Create dhcp by id in a private cloud workload network. + + Create dhcp by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. + :type dhcp_id: str + :param workload_network_dhcp: NSX DHCP. + :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDhcp"] + 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_dhcp_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dhcp_id=dhcp_id, + workload_network_dhcp=workload_network_dhcp, + 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('WorkloadNetworkDhcp', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dhcpId': self._serialize.url("dhcp_id", dhcp_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_dhcp.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + + def _update_dhcp_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + dhcp_id, # type: str + workload_network_dhcp, # type: "_models.WorkloadNetworkDhcp" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.WorkloadNetworkDhcp"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WorkloadNetworkDhcp"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_dhcp_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dhcpId': self._serialize.url("dhcp_id", dhcp_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['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(workload_network_dhcp, 'WorkloadNetworkDhcp') + 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('WorkloadNetworkDhcp', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_dhcp_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + + def begin_update_dhcp( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + dhcp_id, # type: str + workload_network_dhcp, # type: "_models.WorkloadNetworkDhcp" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.WorkloadNetworkDhcp"] + """Create or update dhcp by id in a private cloud workload network. + + Create or update dhcp by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. + :type dhcp_id: str + :param workload_network_dhcp: NSX DHCP. + :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDhcp"] + 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_dhcp_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dhcp_id=dhcp_id, + workload_network_dhcp=workload_network_dhcp, + 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('WorkloadNetworkDhcp', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dhcpId': self._serialize.url("dhcp_id", dhcp_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_dhcp.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + + def _delete_dhcp_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + dhcp_id, # type: 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_dhcp_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dhcpId': self._serialize.url("dhcp_id", dhcp_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.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_dhcp_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + + def begin_delete_dhcp( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + dhcp_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete dhcp by id in a private cloud workload network. + + Delete dhcp by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. + :type dhcp_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_dhcp_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dhcp_id=dhcp_id, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dhcpId': self._serialize.url("dhcp_id", dhcp_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_dhcp.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + + def list_gateways( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.WorkloadNetworkGatewayList"] + """List of gateways in a private cloud workload network. + + List of gateways in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkloadNetworkGatewayList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkGatewayList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkGatewayList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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_gateways.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('WorkloadNetworkGatewayList', 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_gateways.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways'} # type: ignore + + def get_gateway( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + gateway_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.WorkloadNetworkGateway" + """Get a gateway by id in a private cloud workload network. + + Get a gateway by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param gateway_id: NSX Gateway identifier. Generally the same as the Gateway's display name. + :type gateway_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkloadNetworkGateway, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkGateway + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkGateway"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get_gateway.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'gatewayId': self._serialize.url("gateway_id", gateway_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('WorkloadNetworkGateway', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId}'} # type: ignore + + def list_port_mirroring( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.WorkloadNetworkPortMirroringList"] + """List of port mirroring profiles in a private cloud workload network. + + List of port mirroring profiles in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkloadNetworkPortMirroringList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPortMirroringList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPortMirroringList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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_port_mirroring.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('WorkloadNetworkPortMirroringList', 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_port_mirroring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles'} # type: ignore + + def get_port_mirroring( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + port_mirroring_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.WorkloadNetworkPortMirroring" + """Get a port mirroring profile by id in a private cloud workload network. + + Get a port mirroring profile by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port + Mirroring display name. + :type port_mirroring_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkloadNetworkPortMirroring, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPortMirroring"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get_port_mirroring.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_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('WorkloadNetworkPortMirroring', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_port_mirroring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + + def _create_port_mirroring_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + port_mirroring_id, # type: str + workload_network_port_mirroring, # type: "_models.WorkloadNetworkPortMirroring" + **kwargs # type: Any + ): + # type: (...) -> "_models.WorkloadNetworkPortMirroring" + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPortMirroring"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_port_mirroring_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_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['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(workload_network_port_mirroring, 'WorkloadNetworkPortMirroring') + 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('WorkloadNetworkPortMirroring', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WorkloadNetworkPortMirroring', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_port_mirroring_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + + def begin_create_port_mirroring( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + port_mirroring_id, # type: str + workload_network_port_mirroring, # type: "_models.WorkloadNetworkPortMirroring" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.WorkloadNetworkPortMirroring"] + """Create a port mirroring profile by id in a private cloud workload network. + + Create a port mirroring profile by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port + Mirroring display name. + :type port_mirroring_id: str + :param workload_network_port_mirroring: NSX port mirroring. + :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPortMirroring"] + 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_port_mirroring_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + port_mirroring_id=port_mirroring_id, + workload_network_port_mirroring=workload_network_port_mirroring, + 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('WorkloadNetworkPortMirroring', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_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_port_mirroring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + + def _update_port_mirroring_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + port_mirroring_id, # type: str + workload_network_port_mirroring, # type: "_models.WorkloadNetworkPortMirroring" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.WorkloadNetworkPortMirroring"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WorkloadNetworkPortMirroring"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_port_mirroring_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_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['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(workload_network_port_mirroring, 'WorkloadNetworkPortMirroring') + 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('WorkloadNetworkPortMirroring', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_port_mirroring_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + + def begin_update_port_mirroring( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + port_mirroring_id, # type: str + workload_network_port_mirroring, # type: "_models.WorkloadNetworkPortMirroring" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.WorkloadNetworkPortMirroring"] + """Create or update a port mirroring profile by id in a private cloud workload network. + + Create or update a port mirroring profile by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port + Mirroring display name. + :type port_mirroring_id: str + :param workload_network_port_mirroring: NSX port mirroring. + :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPortMirroring"] + 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_port_mirroring_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + port_mirroring_id=port_mirroring_id, + workload_network_port_mirroring=workload_network_port_mirroring, + 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('WorkloadNetworkPortMirroring', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_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_port_mirroring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + + def _delete_port_mirroring_initial( + self, + resource_group_name, # type: str + port_mirroring_id, # type: str + private_cloud_name, # type: 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_port_mirroring_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.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_port_mirroring_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + + def begin_delete_port_mirroring( + self, + resource_group_name, # type: str + port_mirroring_id, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete a port mirroring profile by id in a private cloud workload network. + + Delete a port mirroring profile by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port + Mirroring display name. + :type port_mirroring_id: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_port_mirroring_initial( + resource_group_name=resource_group_name, + port_mirroring_id=port_mirroring_id, + private_cloud_name=private_cloud_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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_port_mirroring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + + def list_vm_groups( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.WorkloadNetworkVMGroupsList"] + """List of vm groups in a private cloud workload network. + + List of vm groups in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkloadNetworkVMGroupsList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVMGroupsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVMGroupsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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_vm_groups.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('WorkloadNetworkVMGroupsList', 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_vm_groups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups'} # type: ignore + + def get_vm_group( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + vm_group_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.WorkloadNetworkVMGroup" + """Get a vm group by id in a private cloud workload network. + + Get a vm group by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. + :type vm_group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkloadNetworkVMGroup, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVMGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get_vm_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'vmGroupId': self._serialize.url("vm_group_id", vm_group_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('WorkloadNetworkVMGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_vm_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + + def _create_vm_group_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + vm_group_id, # type: str + workload_network_vm_group, # type: "_models.WorkloadNetworkVMGroup" + **kwargs # type: Any + ): + # type: (...) -> "_models.WorkloadNetworkVMGroup" + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVMGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_vm_group_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'vmGroupId': self._serialize.url("vm_group_id", vm_group_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['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(workload_network_vm_group, 'WorkloadNetworkVMGroup') + 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('WorkloadNetworkVMGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WorkloadNetworkVMGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_vm_group_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + + def begin_create_vm_group( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + vm_group_id, # type: str + workload_network_vm_group, # type: "_models.WorkloadNetworkVMGroup" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.WorkloadNetworkVMGroup"] + """Create a vm group by id in a private cloud workload network. + + Create a vm group by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. + :type vm_group_id: str + :param workload_network_vm_group: NSX VM Group. + :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVMGroup"] + 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_vm_group_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + vm_group_id=vm_group_id, + workload_network_vm_group=workload_network_vm_group, + 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('WorkloadNetworkVMGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'vmGroupId': self._serialize.url("vm_group_id", vm_group_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_vm_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + + def _update_vm_group_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + vm_group_id, # type: str + workload_network_vm_group, # type: "_models.WorkloadNetworkVMGroup" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.WorkloadNetworkVMGroup"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WorkloadNetworkVMGroup"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_vm_group_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'vmGroupId': self._serialize.url("vm_group_id", vm_group_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['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(workload_network_vm_group, 'WorkloadNetworkVMGroup') + 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('WorkloadNetworkVMGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_vm_group_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + + def begin_update_vm_group( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + vm_group_id, # type: str + workload_network_vm_group, # type: "_models.WorkloadNetworkVMGroup" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.WorkloadNetworkVMGroup"] + """Create or update a vm group by id in a private cloud workload network. + + Create or update a vm group by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. + :type vm_group_id: str + :param workload_network_vm_group: NSX VM Group. + :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVMGroup"] + 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_vm_group_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + vm_group_id=vm_group_id, + workload_network_vm_group=workload_network_vm_group, + 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('WorkloadNetworkVMGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'vmGroupId': self._serialize.url("vm_group_id", vm_group_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_vm_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + + def _delete_vm_group_initial( + self, + resource_group_name, # type: str + vm_group_id, # type: str + private_cloud_name, # type: 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_vm_group_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'vmGroupId': self._serialize.url("vm_group_id", vm_group_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.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_vm_group_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + + def begin_delete_vm_group( + self, + resource_group_name, # type: str + vm_group_id, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete a vm group by id in a private cloud workload network. + + Delete a vm group by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. + :type vm_group_id: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_vm_group_initial( + resource_group_name=resource_group_name, + vm_group_id=vm_group_id, + private_cloud_name=private_cloud_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'vmGroupId': self._serialize.url("vm_group_id", vm_group_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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_vm_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + + def list_virtual_machines( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.WorkloadNetworkVirtualMachinesList"] + """List of virtual machines in a private cloud workload network. + + List of virtual machines in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkloadNetworkVirtualMachinesList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVirtualMachinesList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVirtualMachinesList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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_virtual_machines.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('WorkloadNetworkVirtualMachinesList', 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_virtual_machines.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines'} # type: ignore + + def get_virtual_machine( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + virtual_machine_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.WorkloadNetworkVirtualMachine" + """Get a virtual machine by id in a private cloud workload network. + + Get a virtual machine by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param virtual_machine_id: Virtual Machine identifier. + :type virtual_machine_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkloadNetworkVirtualMachine, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVirtualMachine"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get_virtual_machine.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'virtualMachineId': self._serialize.url("virtual_machine_id", virtual_machine_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('WorkloadNetworkVirtualMachine', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_virtual_machine.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId}'} # type: ignore + + def list_dns_services( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.WorkloadNetworkDnsServicesList"] + """List of DNS services in a private cloud workload network. + + List of DNS services in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkloadNetworkDnsServicesList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsServicesList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsServicesList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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_dns_services.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('WorkloadNetworkDnsServicesList', 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_dns_services.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices'} # type: ignore + + def get_dns_service( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + dns_service_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.WorkloadNetworkDnsService" + """Get a DNS service by id in a private cloud workload network. + + Get a DNS service by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's + display name. + :type dns_service_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkloadNetworkDnsService, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkDnsService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get_dns_service.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_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('WorkloadNetworkDnsService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_dns_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + + def _create_dns_service_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + dns_service_id, # type: str + workload_network_dns_service, # type: "_models.WorkloadNetworkDnsService" + **kwargs # type: Any + ): + # type: (...) -> "_models.WorkloadNetworkDnsService" + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_dns_service_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_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['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(workload_network_dns_service, 'WorkloadNetworkDnsService') + 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('WorkloadNetworkDnsService', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WorkloadNetworkDnsService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_dns_service_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + + def begin_create_dns_service( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + dns_service_id, # type: str + workload_network_dns_service, # type: "_models.WorkloadNetworkDnsService" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.WorkloadNetworkDnsService"] + """Create a DNS service by id in a private cloud workload network. + + Create a DNS service by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's + display name. + :type dns_service_id: str + :param workload_network_dns_service: NSX DNS Service. + :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsService"] + 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_dns_service_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_service_id=dns_service_id, + workload_network_dns_service=workload_network_dns_service, + 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('WorkloadNetworkDnsService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_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_dns_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + + def _update_dns_service_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + dns_service_id, # type: str + workload_network_dns_service, # type: "_models.WorkloadNetworkDnsService" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.WorkloadNetworkDnsService"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WorkloadNetworkDnsService"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_dns_service_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_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['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(workload_network_dns_service, 'WorkloadNetworkDnsService') + 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('WorkloadNetworkDnsService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_dns_service_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + + def begin_update_dns_service( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + dns_service_id, # type: str + workload_network_dns_service, # type: "_models.WorkloadNetworkDnsService" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.WorkloadNetworkDnsService"] + """Create or update a DNS service by id in a private cloud workload network. + + Create or update a DNS service by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's + display name. + :type dns_service_id: str + :param workload_network_dns_service: NSX DNS Service. + :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsService"] + 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_dns_service_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_service_id=dns_service_id, + workload_network_dns_service=workload_network_dns_service, + 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('WorkloadNetworkDnsService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_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_dns_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + + def _delete_dns_service_initial( + self, + resource_group_name, # type: str + dns_service_id, # type: str + private_cloud_name, # type: 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_dns_service_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.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_dns_service_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + + def begin_delete_dns_service( + self, + resource_group_name, # type: str + dns_service_id, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete a DNS service by id in a private cloud workload network. + + Delete a DNS service by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's + display name. + :type dns_service_id: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_dns_service_initial( + resource_group_name=resource_group_name, + dns_service_id=dns_service_id, + private_cloud_name=private_cloud_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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_dns_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + + def list_dns_zones( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.WorkloadNetworkDnsZonesList"] + """List of DNS zones in a private cloud workload network. + + List of DNS zones in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkloadNetworkDnsZonesList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsZonesList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsZonesList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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_dns_zones.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('WorkloadNetworkDnsZonesList', 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_dns_zones.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones'} # type: ignore + + def get_dns_zone( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + dns_zone_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.WorkloadNetworkDnsZone" + """Get a DNS zone by id in a private cloud workload network. + + Get a DNS zone by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + :type dns_zone_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkloadNetworkDnsZone, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsZone"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get_dns_zone.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_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('WorkloadNetworkDnsZone', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_dns_zone.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + + def _create_dns_zone_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + dns_zone_id, # type: str + workload_network_dns_zone, # type: "_models.WorkloadNetworkDnsZone" + **kwargs # type: Any + ): + # type: (...) -> "_models.WorkloadNetworkDnsZone" + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsZone"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_dns_zone_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_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['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(workload_network_dns_zone, 'WorkloadNetworkDnsZone') + 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('WorkloadNetworkDnsZone', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WorkloadNetworkDnsZone', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_dns_zone_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + + def begin_create_dns_zone( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + dns_zone_id, # type: str + workload_network_dns_zone, # type: "_models.WorkloadNetworkDnsZone" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.WorkloadNetworkDnsZone"] + """Create a DNS zone by id in a private cloud workload network. + + Create a DNS zone by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + :type dns_zone_id: str + :param workload_network_dns_zone: NSX DNS Zone. + :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsZone"] + 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_dns_zone_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_zone_id=dns_zone_id, + workload_network_dns_zone=workload_network_dns_zone, + 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('WorkloadNetworkDnsZone', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_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_dns_zone.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + + def _update_dns_zone_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + dns_zone_id, # type: str + workload_network_dns_zone, # type: "_models.WorkloadNetworkDnsZone" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.WorkloadNetworkDnsZone"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WorkloadNetworkDnsZone"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_dns_zone_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_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['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(workload_network_dns_zone, 'WorkloadNetworkDnsZone') + 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('WorkloadNetworkDnsZone', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_dns_zone_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + + def begin_update_dns_zone( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + dns_zone_id, # type: str + workload_network_dns_zone, # type: "_models.WorkloadNetworkDnsZone" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.WorkloadNetworkDnsZone"] + """Create or update a DNS zone by id in a private cloud workload network. + + Create or update a DNS zone by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + :type dns_zone_id: str + :param workload_network_dns_zone: NSX DNS Zone. + :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsZone"] + 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_dns_zone_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_zone_id=dns_zone_id, + workload_network_dns_zone=workload_network_dns_zone, + 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('WorkloadNetworkDnsZone', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_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_dns_zone.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + + def _delete_dns_zone_initial( + self, + resource_group_name, # type: str + dns_zone_id, # type: str + private_cloud_name, # type: 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_dns_zone_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.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_dns_zone_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + + def begin_delete_dns_zone( + self, + resource_group_name, # type: str + dns_zone_id, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete a DNS zone by id in a private cloud workload network. + + Delete a DNS zone by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + :type dns_zone_id: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_dns_zone_initial( + resource_group_name=resource_group_name, + dns_zone_id=dns_zone_id, + private_cloud_name=private_cloud_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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_dns_zone.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + + def list_public_i_ps( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.WorkloadNetworkPublicIPsList"] + """List of Public IP Blocks in a private cloud workload network. + + List of Public IP Blocks in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkloadNetworkPublicIPsList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPublicIPsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPublicIPsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-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_public_i_ps.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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') + + 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('WorkloadNetworkPublicIPsList', 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_public_i_ps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs'} # type: ignore + + def get_public_ip( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + public_ip_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.WorkloadNetworkPublicIP" + """Get a Public IP Block by id in a private cloud workload network. + + Get a Public IP Block by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP + Block's display name. + :type public_ip_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkloadNetworkPublicIP, or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPublicIP"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self.get_public_ip.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'publicIPId': self._serialize.url("public_ip_id", public_ip_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('WorkloadNetworkPublicIP', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_public_ip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}'} # type: ignore + + def _create_public_ip_initial( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + public_ip_id, # type: str + workload_network_public_ip, # type: "_models.WorkloadNetworkPublicIP" + **kwargs # type: Any + ): + # type: (...) -> "_models.WorkloadNetworkPublicIP" + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPublicIP"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_public_ip_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'publicIPId': self._serialize.url("public_ip_id", public_ip_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['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(workload_network_public_ip, 'WorkloadNetworkPublicIP') + 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('WorkloadNetworkPublicIP', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WorkloadNetworkPublicIP', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_public_ip_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}'} # type: ignore + + def begin_create_public_ip( + self, + resource_group_name, # type: str + private_cloud_name, # type: str + public_ip_id, # type: str + workload_network_public_ip, # type: "_models.WorkloadNetworkPublicIP" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.WorkloadNetworkPublicIP"] + """Create a Public IP Block by id in a private cloud workload network. + + Create a Public IP Block by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP + Block's display name. + :type public_ip_id: str + :param workload_network_public_ip: NSX Public IP Block. + :type workload_network_public_ip: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkPublicIP or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPublicIP"] + 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_public_ip_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + public_ip_id=public_ip_id, + workload_network_public_ip=workload_network_public_ip, + 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('WorkloadNetworkPublicIP', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), + 'publicIPId': self._serialize.url("public_ip_id", public_ip_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_public_ip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}'} # type: ignore + + def _delete_public_ip_initial( + self, + resource_group_name, # type: str + public_ip_id, # type: str + private_cloud_name, # type: 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 = "2021-06-01" + accept = "application/json" + + # Construct URL + url = self._delete_public_ip_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'publicIPId': self._serialize.url("public_ip_id", public_ip_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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.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_public_ip_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}'} # type: ignore + + def begin_delete_public_ip( + self, + resource_group_name, # type: str + public_ip_id, # type: str + private_cloud_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete a Public IP Block by id in a private cloud workload network. + + Delete a Public IP Block by id in a private cloud workload network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP + Block's display name. + :type public_ip_id: str + :param private_cloud_name: Name of the private cloud. + :type private_cloud_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_public_ip_initial( + resource_group_name=resource_group_name, + public_ip_id=public_ip_id, + private_cloud_name=private_cloud_name, + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'publicIPId': self._serialize.url("public_ip_id", public_ip_id, 'str'), + 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, '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_public_ip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/py.typed b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-avs/sdk_packaging.toml b/sdk/compute/azure-mgmt-avs/sdk_packaging.toml new file mode 100644 index 000000000000..1041b049eb9f --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-avs" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Avs Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/compute/azure-mgmt-avs/setup.cfg b/sdk/compute/azure-mgmt-avs/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/compute/azure-mgmt-avs/setup.py b/sdk/compute/azure-mgmt-avs/setup.py new file mode 100644 index 000000000000..d20ca95cbb7e --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/setup.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-avs" +PACKAGE_PPRINT_NAME = "Avs Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +) diff --git a/sdk/compute/ci.yml b/sdk/compute/ci.yml index 58708e30669a..f960170a1b44 100644 --- a/sdk/compute/ci.yml +++ b/sdk/compute/ci.yml @@ -33,4 +33,6 @@ extends: - name: azure-mgmt-imagebuilder safeName: azuremgmtimagebuilder - name: azure-mgmt-vmwarecloudsimple - safeName: azuremgmtvmwarecloudsimple \ No newline at end of file + safeName: azuremgmtvmwarecloudsimple + - name: azure-mgmt-avs + safeName: azuremgmtavs \ No newline at end of file diff --git a/shared_requirements.txt b/shared_requirements.txt index da2905f5c2ce..12bd07748121 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -319,3 +319,4 @@ opentelemetry-sdk<2.0.0,>=1.0.0 #override azure-mgmt-agrifood msrest>=0.6.21 #override azure-mgmt-guestconfig msrest>=0.6.21 #override azure-mgmt-recoveryservices msrest>=0.6.21 +#override azure-mgmt-avs msrest>=0.6.21