diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/CHANGELOG.md b/sdk/compute/azure-mgmt-vmwarecloudsimple/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/MANIFEST.in b/sdk/compute/azure-mgmt-vmwarecloudsimple/MANIFEST.in new file mode 100644 index 000000000000..3a9b6517412b --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/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-vmwarecloudsimple/README.md b/sdk/compute/azure-mgmt-vmwarecloudsimple/README.md new file mode 100644 index 000000000000..7b34161f71f5 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService 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 [MyService 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-vmwarecloudsimple%2FREADME.png) diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/_meta.json b/sdk/compute/azure-mgmt-vmwarecloudsimple/_meta.json new file mode 100644 index 000000000000..77ed81363570 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.2", + "use": [ + "@autorest/python@5.8.0", + "@autorest/modelerfour@4.19.1" + ], + "commit": "77de11b36c3dd529a870c8bbbb90e74fe0e17327", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/vmwarecloudsimple/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.0 --use=@autorest/modelerfour@4.19.1 --version=3.4.2", + "readme": "specification/vmwarecloudsimple/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/__init__.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/__init__.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/__init__.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/__init__.py new file mode 100644 index 000000000000..ca23dad5324b --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/__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 ._vmware_cloud_simple import VMwareCloudSimple +from ._version import VERSION + +__version__ = VERSION +__all__ = ['VMwareCloudSimple'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/_configuration.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/_configuration.py new file mode 100644 index 000000000000..3b37af70578d --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/_configuration.py @@ -0,0 +1,77 @@ +# 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 VMwareCloudSimpleConfiguration(Configuration): + """Configuration for VMwareCloudSimple. + + 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 subscription ID. + :type subscription_id: str + :param referer: referer url. + :type referer: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + referer, # 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.") + if referer is None: + raise ValueError("Parameter 'referer' must not be None.") + super(VMwareCloudSimpleConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.referer = referer + self.api_version = "2019-04-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-vmwarecloudsimple/{}'.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-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/_metadata.json b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/_metadata.json new file mode 100644 index 000000000000..3fdc287defc4 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/_metadata.json @@ -0,0 +1,125 @@ +{ + "chosen_version": "2019-04-01", + "total_api_version_list": ["2019-04-01"], + "client": { + "name": "VMwareCloudSimple", + "filename": "_vmware_cloud_simple", + "description": "Description of the new service.", + "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\": [\"VMwareCloudSimpleConfiguration\"]}}, \"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\": [\"VMwareCloudSimpleConfiguration\"]}}, \"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 subscription ID.", + "docstring_type": "str", + "required": true + }, + "referer": { + "signature": "referer, # type: str", + "description": "referer url.", + "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 subscription ID.", + "docstring_type": "str", + "required": true + }, + "referer": { + "signature": "referer: str,", + "description": "referer url.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id, referer", + "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", + "dedicated_cloud_nodes": "DedicatedCloudNodesOperations", + "dedicated_cloud_services": "DedicatedCloudServicesOperations", + "skus_availability": "SkusAvailabilityOperations", + "private_clouds": "PrivateCloudsOperations", + "customization_policies": "CustomizationPoliciesOperations", + "resource_pools": "ResourcePoolsOperations", + "virtual_machine_templates": "VirtualMachineTemplatesOperations", + "virtual_networks": "VirtualNetworksOperations", + "usages": "UsagesOperations", + "virtual_machines": "VirtualMachinesOperations" + } +} \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/_version.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/_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 = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/_vmware_cloud_simple.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/_vmware_cloud_simple.py new file mode 100644 index 000000000000..76cd102f2335 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/_vmware_cloud_simple.py @@ -0,0 +1,142 @@ +# 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 VMwareCloudSimpleConfiguration +from .operations import Operations +from .operations import DedicatedCloudNodesOperations +from .operations import DedicatedCloudServicesOperations +from .operations import SkusAvailabilityOperations +from .operations import PrivateCloudsOperations +from .operations import CustomizationPoliciesOperations +from .operations import ResourcePoolsOperations +from .operations import VirtualMachineTemplatesOperations +from .operations import VirtualNetworksOperations +from .operations import UsagesOperations +from .operations import VirtualMachinesOperations +from . import models + + +class VMwareCloudSimple(object): + """Description of the new service. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.vmwarecloudsimple.operations.Operations + :ivar dedicated_cloud_nodes: DedicatedCloudNodesOperations operations + :vartype dedicated_cloud_nodes: azure.mgmt.vmwarecloudsimple.operations.DedicatedCloudNodesOperations + :ivar dedicated_cloud_services: DedicatedCloudServicesOperations operations + :vartype dedicated_cloud_services: azure.mgmt.vmwarecloudsimple.operations.DedicatedCloudServicesOperations + :ivar skus_availability: SkusAvailabilityOperations operations + :vartype skus_availability: azure.mgmt.vmwarecloudsimple.operations.SkusAvailabilityOperations + :ivar private_clouds: PrivateCloudsOperations operations + :vartype private_clouds: azure.mgmt.vmwarecloudsimple.operations.PrivateCloudsOperations + :ivar customization_policies: CustomizationPoliciesOperations operations + :vartype customization_policies: azure.mgmt.vmwarecloudsimple.operations.CustomizationPoliciesOperations + :ivar resource_pools: ResourcePoolsOperations operations + :vartype resource_pools: azure.mgmt.vmwarecloudsimple.operations.ResourcePoolsOperations + :ivar virtual_machine_templates: VirtualMachineTemplatesOperations operations + :vartype virtual_machine_templates: azure.mgmt.vmwarecloudsimple.operations.VirtualMachineTemplatesOperations + :ivar virtual_networks: VirtualNetworksOperations operations + :vartype virtual_networks: azure.mgmt.vmwarecloudsimple.operations.VirtualNetworksOperations + :ivar usages: UsagesOperations operations + :vartype usages: azure.mgmt.vmwarecloudsimple.operations.UsagesOperations + :ivar virtual_machines: VirtualMachinesOperations operations + :vartype virtual_machines: azure.mgmt.vmwarecloudsimple.operations.VirtualMachinesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The subscription ID. + :type subscription_id: str + :param referer: referer url. + :type referer: 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 + referer, # 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 = VMwareCloudSimpleConfiguration(credential, subscription_id, referer, **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.dedicated_cloud_nodes = DedicatedCloudNodesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.dedicated_cloud_services = DedicatedCloudServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.skus_availability = SkusAvailabilityOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_clouds = PrivateCloudsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.customization_policies = CustomizationPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resource_pools = ResourcePoolsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_templates = VirtualMachineTemplatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_networks = VirtualNetworksOperations( + self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machines = VirtualMachinesOperations( + 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'), + } + 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: () -> VMwareCloudSimple + 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-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/__init__.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/__init__.py new file mode 100644 index 000000000000..3f7265021d03 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/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 ._vmware_cloud_simple import VMwareCloudSimple +__all__ = ['VMwareCloudSimple'] diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/_configuration.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/_configuration.py new file mode 100644 index 000000000000..fc85ddca0a23 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/_configuration.py @@ -0,0 +1,73 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, 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 VMwareCloudSimpleConfiguration(Configuration): + """Configuration for VMwareCloudSimple. + + 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 subscription ID. + :type subscription_id: str + :param referer: referer url. + :type referer: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + referer: 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.") + if referer is None: + raise ValueError("Parameter 'referer' must not be None.") + super(VMwareCloudSimpleConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.referer = referer + self.api_version = "2019-04-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-vmwarecloudsimple/{}'.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-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/_vmware_cloud_simple.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/_vmware_cloud_simple.py new file mode 100644 index 000000000000..a35ac3b83d28 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/_vmware_cloud_simple.py @@ -0,0 +1,135 @@ +# 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 VMwareCloudSimpleConfiguration +from .operations import Operations +from .operations import DedicatedCloudNodesOperations +from .operations import DedicatedCloudServicesOperations +from .operations import SkusAvailabilityOperations +from .operations import PrivateCloudsOperations +from .operations import CustomizationPoliciesOperations +from .operations import ResourcePoolsOperations +from .operations import VirtualMachineTemplatesOperations +from .operations import VirtualNetworksOperations +from .operations import UsagesOperations +from .operations import VirtualMachinesOperations +from .. import models + + +class VMwareCloudSimple(object): + """Description of the new service. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.vmwarecloudsimple.aio.operations.Operations + :ivar dedicated_cloud_nodes: DedicatedCloudNodesOperations operations + :vartype dedicated_cloud_nodes: azure.mgmt.vmwarecloudsimple.aio.operations.DedicatedCloudNodesOperations + :ivar dedicated_cloud_services: DedicatedCloudServicesOperations operations + :vartype dedicated_cloud_services: azure.mgmt.vmwarecloudsimple.aio.operations.DedicatedCloudServicesOperations + :ivar skus_availability: SkusAvailabilityOperations operations + :vartype skus_availability: azure.mgmt.vmwarecloudsimple.aio.operations.SkusAvailabilityOperations + :ivar private_clouds: PrivateCloudsOperations operations + :vartype private_clouds: azure.mgmt.vmwarecloudsimple.aio.operations.PrivateCloudsOperations + :ivar customization_policies: CustomizationPoliciesOperations operations + :vartype customization_policies: azure.mgmt.vmwarecloudsimple.aio.operations.CustomizationPoliciesOperations + :ivar resource_pools: ResourcePoolsOperations operations + :vartype resource_pools: azure.mgmt.vmwarecloudsimple.aio.operations.ResourcePoolsOperations + :ivar virtual_machine_templates: VirtualMachineTemplatesOperations operations + :vartype virtual_machine_templates: azure.mgmt.vmwarecloudsimple.aio.operations.VirtualMachineTemplatesOperations + :ivar virtual_networks: VirtualNetworksOperations operations + :vartype virtual_networks: azure.mgmt.vmwarecloudsimple.aio.operations.VirtualNetworksOperations + :ivar usages: UsagesOperations operations + :vartype usages: azure.mgmt.vmwarecloudsimple.aio.operations.UsagesOperations + :ivar virtual_machines: VirtualMachinesOperations operations + :vartype virtual_machines: azure.mgmt.vmwarecloudsimple.aio.operations.VirtualMachinesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The subscription ID. + :type subscription_id: str + :param referer: referer url. + :type referer: 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, + referer: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = VMwareCloudSimpleConfiguration(credential, subscription_id, referer, **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.dedicated_cloud_nodes = DedicatedCloudNodesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.dedicated_cloud_services = DedicatedCloudServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.skus_availability = SkusAvailabilityOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_clouds = PrivateCloudsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.customization_policies = CustomizationPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resource_pools = ResourcePoolsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_templates = VirtualMachineTemplatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_networks = VirtualNetworksOperations( + self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machines = VirtualMachinesOperations( + 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'), + } + 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) -> "VMwareCloudSimple": + 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-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/__init__.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/__init__.py new file mode 100644 index 000000000000..b0acb1dfd4ae --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/__init__.py @@ -0,0 +1,33 @@ +# 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 ._dedicated_cloud_nodes_operations import DedicatedCloudNodesOperations +from ._dedicated_cloud_services_operations import DedicatedCloudServicesOperations +from ._skus_availability_operations import SkusAvailabilityOperations +from ._private_clouds_operations import PrivateCloudsOperations +from ._customization_policies_operations import CustomizationPoliciesOperations +from ._resource_pools_operations import ResourcePoolsOperations +from ._virtual_machine_templates_operations import VirtualMachineTemplatesOperations +from ._virtual_networks_operations import VirtualNetworksOperations +from ._usages_operations import UsagesOperations +from ._virtual_machines_operations import VirtualMachinesOperations + +__all__ = [ + 'Operations', + 'DedicatedCloudNodesOperations', + 'DedicatedCloudServicesOperations', + 'SkusAvailabilityOperations', + 'PrivateCloudsOperations', + 'CustomizationPoliciesOperations', + 'ResourcePoolsOperations', + 'VirtualMachineTemplatesOperations', + 'VirtualNetworksOperations', + 'UsagesOperations', + 'VirtualMachinesOperations', +] diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_customization_policies_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_customization_policies_operations.py new file mode 100644 index 000000000000..5f0ae853980f --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_customization_policies_operations.py @@ -0,0 +1,190 @@ +# 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 CustomizationPoliciesOperations: + """CustomizationPoliciesOperations 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.vmwarecloudsimple.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, + region_id: str, + pc_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.CustomizationPoliciesListResponse"]: + """Implements get of customization policies list. + + Returns list of customization policies in region for private cloud. + + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param pc_name: The private cloud name. + :type pc_name: str + :param filter: The filter to apply on the list operation. only type is allowed here as a filter + e.g. $filter=type eq 'xxxx'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomizationPoliciesListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.vmwarecloudsimple.models.CustomizationPoliciesListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomizationPoliciesListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_id, 'str'), + 'pcName': self._serialize.url("pc_name", pc_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') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, '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('CustomizationPoliciesListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/customizationPolicies'} # type: ignore + + async def get( + self, + region_id: str, + pc_name: str, + customization_policy_name: str, + **kwargs: Any + ) -> "_models.CustomizationPolicy": + """Implements get of customization policy. + + Returns customization policy by its name. + + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param pc_name: The private cloud name. + :type pc_name: str + :param customization_policy_name: customization policy name. + :type customization_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomizationPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.CustomizationPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomizationPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_id, 'str'), + 'pcName': self._serialize.url("pc_name", pc_name, 'str'), + 'customizationPolicyName': self._serialize.url("customization_policy_name", customization_policy_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) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomizationPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/customizationPolicies/{customizationPolicyName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_dedicated_cloud_nodes_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_dedicated_cloud_nodes_operations.py new file mode 100644 index 000000000000..8c278257cd75 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_dedicated_cloud_nodes_operations.py @@ -0,0 +1,541 @@ +# 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 DedicatedCloudNodesOperations: + """DedicatedCloudNodesOperations 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.vmwarecloudsimple.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_by_subscription( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DedicatedCloudNodeListResponse"]: + """Implements list of dedicated cloud nodes within subscription method. + + Returns list of dedicate cloud nodes within subscription. + + :param filter: The filter to apply on the list operation. + :type filter: str + :param top: The maximum number of record sets to return. + :type top: int + :param skip_token: to be used by nextLink implementation. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DedicatedCloudNodeListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudNodeListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudNodeListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, '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('DedicatedCloudNodeListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudNodes'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DedicatedCloudNodeListResponse"]: + """Implements list of dedicated cloud nodes within RG method. + + Returns list of dedicate cloud nodes within resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param filter: The filter to apply on the list operation. + :type filter: str + :param top: The maximum number of record sets to return. + :type top: int + :param skip_token: to be used by nextLink implementation. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DedicatedCloudNodeListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudNodeListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudNodeListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, '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('DedicatedCloudNodeListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudNodes'} # type: ignore + + async def get( + self, + resource_group_name: str, + dedicated_cloud_node_name: str, + **kwargs: Any + ) -> "_models.DedicatedCloudNode": + """Implements dedicated cloud node GET method. + + Returns dedicated cloud node. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dedicated_cloud_node_name: dedicated cloud node name. + :type dedicated_cloud_node_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedCloudNode, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudNode + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudNode"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dedicatedCloudNodeName': self._serialize.url("dedicated_cloud_node_name", dedicated_cloud_node_name, 'str', pattern=r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'), + } + 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) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedCloudNode', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudNodes/{dedicatedCloudNodeName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + dedicated_cloud_node_name: str, + dedicated_cloud_node_request: "_models.DedicatedCloudNode", + **kwargs: Any + ) -> "_models.DedicatedCloudNode": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudNode"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dedicatedCloudNodeName': self._serialize.url("dedicated_cloud_node_name", dedicated_cloud_node_name, 'str', pattern=r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'), + } + 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['Referer'] = self._serialize.header("self._config.referer", self._config.referer, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(dedicated_cloud_node_request, 'DedicatedCloudNode') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + deserialized = self._deserialize('DedicatedCloudNode', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudNodes/{dedicatedCloudNodeName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + dedicated_cloud_node_name: str, + dedicated_cloud_node_request: "_models.DedicatedCloudNode", + **kwargs: Any + ) -> AsyncLROPoller["_models.DedicatedCloudNode"]: + """Implements dedicated cloud node PUT method. + + Returns dedicated cloud node by its name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dedicated_cloud_node_name: dedicated cloud node name. + :type dedicated_cloud_node_name: str + :param dedicated_cloud_node_request: Create Dedicated Cloud Node request. + :type dedicated_cloud_node_request: ~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudNode + :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 DedicatedCloudNode or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudNode] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudNode"] + 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, + dedicated_cloud_node_name=dedicated_cloud_node_name, + dedicated_cloud_node_request=dedicated_cloud_node_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + deserialized = self._deserialize('DedicatedCloudNode', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dedicatedCloudNodeName': self._serialize.url("dedicated_cloud_node_name", dedicated_cloud_node_name, 'str', pattern=r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'), + } + + 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.VMwareCloudSimple/dedicatedCloudNodes/{dedicatedCloudNodeName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + dedicated_cloud_node_name: str, + **kwargs: Any + ) -> None: + """Implements dedicated cloud node DELETE method. + + Delete dedicated cloud node. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dedicated_cloud_node_name: dedicated cloud node name. + :type dedicated_cloud_node_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 = "2019-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dedicatedCloudNodeName': self._serialize.url("dedicated_cloud_node_name", dedicated_cloud_node_name, 'str', pattern=r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'), + } + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudNodes/{dedicatedCloudNodeName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + dedicated_cloud_node_name: str, + dedicated_cloud_node_request: "_models.PatchPayload", + **kwargs: Any + ) -> "_models.DedicatedCloudNode": + """Implements dedicated cloud node PATCH method. + + Patches dedicated node properties. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dedicated_cloud_node_name: dedicated cloud node name. + :type dedicated_cloud_node_name: str + :param dedicated_cloud_node_request: Patch Dedicated Cloud Node request. + :type dedicated_cloud_node_request: ~azure.mgmt.vmwarecloudsimple.models.PatchPayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedCloudNode, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudNode + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudNode"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dedicatedCloudNodeName': self._serialize.url("dedicated_cloud_node_name", dedicated_cloud_node_name, 'str', pattern=r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'), + } + 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(dedicated_cloud_node_request, 'PatchPayload') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedCloudNode', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudNodes/{dedicatedCloudNodeName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_dedicated_cloud_services_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_dedicated_cloud_services_operations.py new file mode 100644 index 000000000000..7cc71d65f448 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_dedicated_cloud_services_operations.py @@ -0,0 +1,526 @@ +# 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 DedicatedCloudServicesOperations: + """DedicatedCloudServicesOperations 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.vmwarecloudsimple.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_by_subscription( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DedicatedCloudServiceListResponse"]: + """Implements list of dedicatedCloudService objects within subscription method. + + Returns list of dedicated cloud services within a subscription. + + :param filter: The filter to apply on the list operation. + :type filter: str + :param top: The maximum number of record sets to return. + :type top: int + :param skip_token: to be used by nextLink implementation. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DedicatedCloudServiceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudServiceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudServiceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, '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('DedicatedCloudServiceListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudServices'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DedicatedCloudServiceListResponse"]: + """Implements list of dedicatedCloudService objects within RG method. + + Returns list of dedicated cloud services within a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param filter: The filter to apply on the list operation. + :type filter: str + :param top: The maximum number of record sets to return. + :type top: int + :param skip_token: to be used by nextLink implementation. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DedicatedCloudServiceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudServiceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudServiceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, '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('DedicatedCloudServiceListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudServices'} # type: ignore + + async def get( + self, + resource_group_name: str, + dedicated_cloud_service_name: str, + **kwargs: Any + ) -> "_models.DedicatedCloudService": + """Implements dedicatedCloudService GET method. + + Returns Dedicate Cloud Service. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dedicated_cloud_service_name: dedicated cloud Service name. + :type dedicated_cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedCloudService, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dedicatedCloudServiceName': self._serialize.url("dedicated_cloud_service_name", dedicated_cloud_service_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) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedCloudService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudServices/{dedicatedCloudServiceName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + dedicated_cloud_service_name: str, + dedicated_cloud_service_request: "_models.DedicatedCloudService", + **kwargs: Any + ) -> "_models.DedicatedCloudService": + """Implements dedicated cloud service PUT method. + + Create dedicate cloud service. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dedicated_cloud_service_name: dedicated cloud Service name. + :type dedicated_cloud_service_name: str + :param dedicated_cloud_service_request: Create Dedicated Cloud Service request. + :type dedicated_cloud_service_request: ~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudService + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedCloudService, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dedicatedCloudServiceName': self._serialize.url("dedicated_cloud_service_name", dedicated_cloud_service_name, 'str', pattern=r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'), + } + 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(dedicated_cloud_service_request, 'DedicatedCloudService') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedCloudService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudServices/{dedicatedCloudServiceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + dedicated_cloud_service_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 = "2019-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dedicatedCloudServiceName': self._serialize.url("dedicated_cloud_service_name", dedicated_cloud_service_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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudServices/{dedicatedCloudServiceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + dedicated_cloud_service_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements dedicatedCloudService DELETE method. + + Delete dedicate cloud service. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dedicated_cloud_service_name: dedicated cloud service name. + :type dedicated_cloud_service_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, + dedicated_cloud_service_name=dedicated_cloud_service_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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dedicatedCloudServiceName': self._serialize.url("dedicated_cloud_service_name", dedicated_cloud_service_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.VMwareCloudSimple/dedicatedCloudServices/{dedicatedCloudServiceName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + dedicated_cloud_service_name: str, + dedicated_cloud_service_request: "_models.PatchPayload", + **kwargs: Any + ) -> "_models.DedicatedCloudService": + """Implements dedicatedCloudService PATCH method. + + Patch dedicated cloud service's properties. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dedicated_cloud_service_name: dedicated cloud service name. + :type dedicated_cloud_service_name: str + :param dedicated_cloud_service_request: Patch Dedicated Cloud Service request. + :type dedicated_cloud_service_request: ~azure.mgmt.vmwarecloudsimple.models.PatchPayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedCloudService, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dedicatedCloudServiceName': self._serialize.url("dedicated_cloud_service_name", dedicated_cloud_service_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(dedicated_cloud_service_request, 'PatchPayload') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedCloudService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudServices/{dedicatedCloudServiceName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_operations.py new file mode 100644 index 000000000000..117d07dfd6a9 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_operations.py @@ -0,0 +1,176 @@ +# 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.vmwarecloudsimple.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.AvailableOperationsListResponse"]: + """Implements list of available operations. + + Return list of operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableOperationsListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.vmwarecloudsimple.models.AvailableOperationsListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperationsListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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('AvailableOperationsListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.VMwareCloudSimple/operations'} # type: ignore + + async def get( + self, + region_id: str, + operation_id: str, + **kwargs: Any + ) -> Optional["_models.OperationResource"]: + """Implements get of async operation. + + Return an async operation. + + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param operation_id: operation id. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationResource, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.OperationResource or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_id, 'str'), + 'operationId': self._serialize.url("operation_id", operation_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['Referer'] = self._serialize.header("self._config.referer", self._config.referer, 'str') + 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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationResource', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/operationResults/{operationId}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_private_clouds_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_private_clouds_operations.py new file mode 100644 index 000000000000..e400d75683e5 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_private_clouds_operations.py @@ -0,0 +1,176 @@ +# 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 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.vmwarecloudsimple.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, + region_id: str, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateCloudList"]: + """Implements private cloud list GET method. + + Returns list of private clouds in particular region. + + :param region_id: The region Id (westus, eastus). + :type region_id: 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.vmwarecloudsimple.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 = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_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') + + 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds'} # type: ignore + + async def get( + self, + pc_name: str, + region_id: str, + **kwargs: Any + ) -> "_models.PrivateCloud": + """Implements private cloud GET method. + + Returns private cloud by its name. + + :param pc_name: The private cloud name. + :type pc_name: str + :param region_id: The region Id (westus, eastus). + :type region_id: 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.vmwarecloudsimple.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 = "2019-04-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'), + 'pcName': self._serialize.url("pc_name", pc_name, 'str'), + 'regionId': self._serialize.url("region_id", region_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) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateCloud', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_resource_pools_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_resource_pools_operations.py new file mode 100644 index 000000000000..8f5433f437f9 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_resource_pools_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 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 ResourcePoolsOperations: + """ResourcePoolsOperations 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.vmwarecloudsimple.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, + region_id: str, + pc_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ResourcePoolsListResponse"]: + """Implements get of resource pools list. + + Returns list of resource pools in region for private cloud. + + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param pc_name: The private cloud name. + :type pc_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourcePoolsListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.vmwarecloudsimple.models.ResourcePoolsListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourcePoolsListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_id, 'str'), + 'pcName': self._serialize.url("pc_name", pc_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('ResourcePoolsListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/resourcePools'} # type: ignore + + async def get( + self, + region_id: str, + pc_name: str, + resource_pool_name: str, + **kwargs: Any + ) -> "_models.ResourcePool": + """Implements get of resource pool. + + Returns resource pool templates by its name. + + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param pc_name: The private cloud name. + :type pc_name: str + :param resource_pool_name: resource pool id (vsphereId). + :type resource_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourcePool, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.ResourcePool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourcePool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_id, 'str'), + 'pcName': self._serialize.url("pc_name", pc_name, 'str'), + 'resourcePoolName': self._serialize.url("resource_pool_name", resource_pool_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) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourcePool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/resourcePools/{resourcePoolName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_skus_availability_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_skus_availability_operations.py new file mode 100644 index 000000000000..e72c2ceece98 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_skus_availability_operations.py @@ -0,0 +1,120 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +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 SkusAvailabilityOperations: + """SkusAvailabilityOperations 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.vmwarecloudsimple.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, + region_id: str, + sku_id: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SkuAvailabilityListResponse"]: + """Implements SkuAvailability List method. + + Returns list of available resources in region. + + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param sku_id: sku id, if no sku is passed availability for all skus will be returned. + :type sku_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuAvailabilityListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.vmwarecloudsimple.models.SkuAvailabilityListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SkuAvailabilityListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if sku_id is not None: + query_parameters['skuId'] = self._serialize.query("sku_id", sku_id, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SkuAvailabilityListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/availabilities'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_usages_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_usages_operations.py new file mode 100644 index 000000000000..901955e13ee3 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_usages_operations.py @@ -0,0 +1,121 @@ +# 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 UsagesOperations: + """UsagesOperations 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.vmwarecloudsimple.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, + region_id: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.UsageListResponse"]: + """Implements Usages List method. + + Returns list of usage in region. + + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param filter: The filter to apply on the list operation. only name.value is allowed here as a + filter e.g. $filter=name.value eq 'xxxx'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UsageListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.vmwarecloudsimple.models.UsageListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('UsageListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/usages'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_virtual_machine_templates_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_virtual_machine_templates_operations.py new file mode 100644 index 000000000000..b9d23e3682d7 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_virtual_machine_templates_operations.py @@ -0,0 +1,189 @@ +# 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 VirtualMachineTemplatesOperations: + """VirtualMachineTemplatesOperations 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.vmwarecloudsimple.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, + pc_name: str, + region_id: str, + resource_pool_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineTemplateListResponse"]: + """Implements list of available VM templates. + + Returns list of virtual machine templates in region for private cloud. + + :param pc_name: The private cloud name. + :type pc_name: str + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param resource_pool_name: Resource pool used to derive vSphere cluster which contains VM + templates. + :type resource_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineTemplateListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.vmwarecloudsimple.models.VirtualMachineTemplateListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineTemplateListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'pcName': self._serialize.url("pc_name", pc_name, 'str'), + 'regionId': self._serialize.url("region_id", region_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') + query_parameters['resourcePoolName'] = self._serialize.query("resource_pool_name", resource_pool_name, '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('VirtualMachineTemplateListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/virtualMachineTemplates'} # type: ignore + + async def get( + self, + region_id: str, + pc_name: str, + virtual_machine_template_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineTemplate": + """Implements virtual machine template GET method. + + Returns virtual machine templates by its name. + + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param pc_name: The private cloud name. + :type pc_name: str + :param virtual_machine_template_name: virtual machine template id (vsphereId). + :type virtual_machine_template_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineTemplate, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.VirtualMachineTemplate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineTemplate"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_id, 'str'), + 'pcName': self._serialize.url("pc_name", pc_name, 'str'), + 'virtualMachineTemplateName': self._serialize.url("virtual_machine_template_name", virtual_machine_template_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) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineTemplate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/virtualMachineTemplates/{virtualMachineTemplateName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_virtual_machines_operations.py new file mode 100644 index 000000000000..3fabeb43a56b --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_virtual_machines_operations.py @@ -0,0 +1,916 @@ +# 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 VirtualMachinesOperations: + """VirtualMachinesOperations 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.vmwarecloudsimple.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_by_subscription( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineListResponse"]: + """Implements list virtual machine within subscription method. + + Returns list virtual machine within subscription. + + :param filter: The filter to apply on the list operation. + :type filter: str + :param top: The maximum number of record sets to return. + :type top: int + :param skip_token: to be used by nextLink implementation. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.vmwarecloudsimple.models.VirtualMachineListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, '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('VirtualMachineListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/virtualMachines'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineListResponse"]: + """Implements list virtual machine within RG method. + + Returns list of virtual machine within resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param filter: The filter to apply on the list operation. + :type filter: str + :param top: The maximum number of record sets to return. + :type top: int + :param skip_token: to be used by nextLink implementation. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.vmwarecloudsimple.models.VirtualMachineListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, '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('VirtualMachineListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines'} # type: ignore + + async def get( + self, + resource_group_name: str, + virtual_machine_name: str, + **kwargs: Any + ) -> "_models.VirtualMachine": + """Implements virtual machine GET method. + + Get virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_machine_name: virtual machine name. + :type virtual_machine_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachine, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.VirtualMachine + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_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) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_request: "_models.VirtualMachine", + **kwargs: Any + ) -> "_models.VirtualMachine": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', pattern=r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'), + } + 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['Referer'] = self._serialize.header("self._config.referer", self._config.referer, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(virtual_machine_request, 'VirtualMachine') + 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) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if response.status_code == 201: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_request: "_models.VirtualMachine", + **kwargs: Any + ) -> AsyncLROPoller["_models.VirtualMachine"]: + """Implements virtual machine PUT method. + + Create Or Update Virtual Machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_machine_name: virtual machine name. + :type virtual_machine_name: str + :param virtual_machine_request: Create or Update Virtual Machine request. + :type virtual_machine_request: ~azure.mgmt.vmwarecloudsimple.models.VirtualMachine + :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 VirtualMachine or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.vmwarecloudsimple.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + 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, + virtual_machine_name=virtual_machine_name, + virtual_machine_request=virtual_machine_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', pattern=r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'), + } + + 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.VMwareCloudSimple/virtualMachines/{virtualMachineName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + virtual_machine_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 = "2019-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_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['Referer'] = self._serialize.header("self._config.referer", self._config.referer, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + virtual_machine_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements virtual machine DELETE method. + + Delete virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_machine_name: virtual machine name. + :type virtual_machine_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, + virtual_machine_name=virtual_machine_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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_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.VMwareCloudSimple/virtualMachines/{virtualMachineName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_request: "_models.PatchPayload", + **kwargs: Any + ) -> "_models.VirtualMachine": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_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(virtual_machine_request, 'PatchPayload') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_request: "_models.PatchPayload", + **kwargs: Any + ) -> AsyncLROPoller["_models.VirtualMachine"]: + """Implements virtual machine PATCH method. + + Patch virtual machine properties. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_machine_name: virtual machine name. + :type virtual_machine_name: str + :param virtual_machine_request: Patch virtual machine request. + :type virtual_machine_request: ~azure.mgmt.vmwarecloudsimple.models.PatchPayload + :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 VirtualMachine or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.vmwarecloudsimple.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + 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, + virtual_machine_name=virtual_machine_name, + virtual_machine_request=virtual_machine_request, + 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('VirtualMachine', 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_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.VMwareCloudSimple/virtualMachines/{virtualMachineName}'} # type: ignore + + async def _start_initial( + self, + resource_group_name: str, + virtual_machine_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 = "2019-04-01" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_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['Referer'] = self._serialize.header("self._config.referer", self._config.referer, 'str') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}/start'} # type: ignore + + async def begin_start( + self, + resource_group_name: str, + virtual_machine_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements a start method for a virtual machine. + + Power on virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_machine_name: virtual machine name. + :type virtual_machine_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._start_initial( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_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_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}/start'} # type: ignore + + async def _stop_initial( + self, + resource_group_name: str, + virtual_machine_name: str, + mode: Optional[Union[str, "_models.StopMode"]] = None, + m: Optional["_models.VirtualMachineStopMode"] = None, + **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 = "2019-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if mode is not None: + query_parameters['mode'] = self._serialize.query("mode", mode, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Referer'] = self._serialize.header("self._config.referer", self._config.referer, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if m is not None: + body_content = self._serialize.body(m, 'VirtualMachineStopMode') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}/stop'} # type: ignore + + async def begin_stop( + self, + resource_group_name: str, + virtual_machine_name: str, + mode: Optional[Union[str, "_models.StopMode"]] = None, + m: Optional["_models.VirtualMachineStopMode"] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements shutdown, poweroff, and suspend method for a virtual machine. + + Power off virtual machine, options: shutdown, poweroff, and suspend. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_machine_name: virtual machine name. + :type virtual_machine_name: str + :param mode: query stop mode parameter (reboot, shutdown, etc...). + :type mode: str or ~azure.mgmt.vmwarecloudsimple.models.StopMode + :param m: body stop mode parameter (reboot, shutdown, etc...). + :type m: ~azure.mgmt.vmwarecloudsimple.models.VirtualMachineStopMode + :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._stop_initial( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + mode=mode, + m=m, + 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_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_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}/stop'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_virtual_networks_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_virtual_networks_operations.py new file mode 100644 index 000000000000..ed4b3033e5d8 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/aio/operations/_virtual_networks_operations.py @@ -0,0 +1,189 @@ +# 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 VirtualNetworksOperations: + """VirtualNetworksOperations 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.vmwarecloudsimple.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, + region_id: str, + pc_name: str, + resource_pool_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualNetworkListResponse"]: + """Implements list available virtual networks within a subscription method. + + Return list of virtual networks in location for private cloud. + + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param pc_name: The private cloud name. + :type pc_name: str + :param resource_pool_name: Resource pool used to derive vSphere cluster which contains virtual + networks. + :type resource_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualNetworkListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.vmwarecloudsimple.models.VirtualNetworkListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_id, 'str'), + 'pcName': self._serialize.url("pc_name", pc_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') + query_parameters['resourcePoolName'] = self._serialize.query("resource_pool_name", resource_pool_name, '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('VirtualNetworkListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/virtualNetworks'} # type: ignore + + async def get( + self, + region_id: str, + pc_name: str, + virtual_network_name: str, + **kwargs: Any + ) -> "_models.VirtualNetwork": + """Implements virtual network GET method. + + Return virtual network by its name. + + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param pc_name: The private cloud name. + :type pc_name: str + :param virtual_network_name: virtual network id (vsphereId). + :type virtual_network_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.VirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetwork"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_id, 'str'), + 'pcName': self._serialize.url("pc_name", pc_name, 'str'), + 'virtualNetworkName': self._serialize.url("virtual_network_name", virtual_network_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) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualNetwork', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/virtualNetworks/{virtualNetworkName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/models/__init__.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/models/__init__.py new file mode 100644 index 000000000000..0da35c52e221 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/models/__init__.py @@ -0,0 +1,181 @@ +# 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 AvailableOperation + from ._models_py3 import AvailableOperationDisplay + from ._models_py3 import AvailableOperationDisplayPropertyServiceSpecificationMetricsItem + from ._models_py3 import AvailableOperationDisplayPropertyServiceSpecificationMetricsList + from ._models_py3 import AvailableOperationsListResponse + from ._models_py3 import CSRPError + from ._models_py3 import CSRPErrorBody + from ._models_py3 import CustomizationHostName + from ._models_py3 import CustomizationIPAddress + from ._models_py3 import CustomizationIPSettings + from ._models_py3 import CustomizationIdentity + from ._models_py3 import CustomizationIdentityUserData + from ._models_py3 import CustomizationNicSetting + from ._models_py3 import CustomizationPoliciesListResponse + from ._models_py3 import CustomizationPolicy + from ._models_py3 import CustomizationSpecification + from ._models_py3 import DedicatedCloudNode + from ._models_py3 import DedicatedCloudNodeListResponse + from ._models_py3 import DedicatedCloudService + from ._models_py3 import DedicatedCloudServiceListResponse + from ._models_py3 import GuestOSCustomization + from ._models_py3 import GuestOSNICCustomization + from ._models_py3 import OperationError + from ._models_py3 import OperationResource + from ._models_py3 import PatchPayload + from ._models_py3 import PrivateCloud + from ._models_py3 import PrivateCloudList + from ._models_py3 import ResourcePool + from ._models_py3 import ResourcePoolsListResponse + from ._models_py3 import Sku + from ._models_py3 import SkuAvailability + from ._models_py3 import SkuAvailabilityListResponse + from ._models_py3 import Usage + from ._models_py3 import UsageListResponse + from ._models_py3 import UsageName + from ._models_py3 import VirtualDisk + from ._models_py3 import VirtualDiskController + from ._models_py3 import VirtualMachine + from ._models_py3 import VirtualMachineListResponse + from ._models_py3 import VirtualMachineStopMode + from ._models_py3 import VirtualMachineTemplate + from ._models_py3 import VirtualMachineTemplateListResponse + from ._models_py3 import VirtualNetwork + from ._models_py3 import VirtualNetworkListResponse + from ._models_py3 import VirtualNic +except (SyntaxError, ImportError): + from ._models import AvailableOperation # type: ignore + from ._models import AvailableOperationDisplay # type: ignore + from ._models import AvailableOperationDisplayPropertyServiceSpecificationMetricsItem # type: ignore + from ._models import AvailableOperationDisplayPropertyServiceSpecificationMetricsList # type: ignore + from ._models import AvailableOperationsListResponse # type: ignore + from ._models import CSRPError # type: ignore + from ._models import CSRPErrorBody # type: ignore + from ._models import CustomizationHostName # type: ignore + from ._models import CustomizationIPAddress # type: ignore + from ._models import CustomizationIPSettings # type: ignore + from ._models import CustomizationIdentity # type: ignore + from ._models import CustomizationIdentityUserData # type: ignore + from ._models import CustomizationNicSetting # type: ignore + from ._models import CustomizationPoliciesListResponse # type: ignore + from ._models import CustomizationPolicy # type: ignore + from ._models import CustomizationSpecification # type: ignore + from ._models import DedicatedCloudNode # type: ignore + from ._models import DedicatedCloudNodeListResponse # type: ignore + from ._models import DedicatedCloudService # type: ignore + from ._models import DedicatedCloudServiceListResponse # type: ignore + from ._models import GuestOSCustomization # type: ignore + from ._models import GuestOSNICCustomization # type: ignore + from ._models import OperationError # type: ignore + from ._models import OperationResource # type: ignore + from ._models import PatchPayload # type: ignore + from ._models import PrivateCloud # type: ignore + from ._models import PrivateCloudList # type: ignore + from ._models import ResourcePool # type: ignore + from ._models import ResourcePoolsListResponse # type: ignore + from ._models import Sku # type: ignore + from ._models import SkuAvailability # type: ignore + from ._models import SkuAvailabilityListResponse # type: ignore + from ._models import Usage # type: ignore + from ._models import UsageListResponse # type: ignore + from ._models import UsageName # type: ignore + from ._models import VirtualDisk # type: ignore + from ._models import VirtualDiskController # type: ignore + from ._models import VirtualMachine # type: ignore + from ._models import VirtualMachineListResponse # type: ignore + from ._models import VirtualMachineStopMode # type: ignore + from ._models import VirtualMachineTemplate # type: ignore + from ._models import VirtualMachineTemplateListResponse # type: ignore + from ._models import VirtualNetwork # type: ignore + from ._models import VirtualNetworkListResponse # type: ignore + from ._models import VirtualNic # type: ignore + +from ._vmware_cloud_simple_enums import ( + AggregationType, + CustomizationHostNameType, + CustomizationIPAddressType, + CustomizationIdentityType, + CustomizationPolicyPropertiesType, + DiskIndependenceMode, + GuestOSNICCustomizationAllocation, + GuestOSType, + NICType, + NodeStatus, + OnboardingStatus, + OperationOrigin, + StopMode, + UsageCount, + VirtualMachineStatus, +) + +__all__ = [ + 'AvailableOperation', + 'AvailableOperationDisplay', + 'AvailableOperationDisplayPropertyServiceSpecificationMetricsItem', + 'AvailableOperationDisplayPropertyServiceSpecificationMetricsList', + 'AvailableOperationsListResponse', + 'CSRPError', + 'CSRPErrorBody', + 'CustomizationHostName', + 'CustomizationIPAddress', + 'CustomizationIPSettings', + 'CustomizationIdentity', + 'CustomizationIdentityUserData', + 'CustomizationNicSetting', + 'CustomizationPoliciesListResponse', + 'CustomizationPolicy', + 'CustomizationSpecification', + 'DedicatedCloudNode', + 'DedicatedCloudNodeListResponse', + 'DedicatedCloudService', + 'DedicatedCloudServiceListResponse', + 'GuestOSCustomization', + 'GuestOSNICCustomization', + 'OperationError', + 'OperationResource', + 'PatchPayload', + 'PrivateCloud', + 'PrivateCloudList', + 'ResourcePool', + 'ResourcePoolsListResponse', + 'Sku', + 'SkuAvailability', + 'SkuAvailabilityListResponse', + 'Usage', + 'UsageListResponse', + 'UsageName', + 'VirtualDisk', + 'VirtualDiskController', + 'VirtualMachine', + 'VirtualMachineListResponse', + 'VirtualMachineStopMode', + 'VirtualMachineTemplate', + 'VirtualMachineTemplateListResponse', + 'VirtualNetwork', + 'VirtualNetworkListResponse', + 'VirtualNic', + 'AggregationType', + 'CustomizationHostNameType', + 'CustomizationIPAddressType', + 'CustomizationIdentityType', + 'CustomizationPolicyPropertiesType', + 'DiskIndependenceMode', + 'GuestOSNICCustomizationAllocation', + 'GuestOSType', + 'NICType', + 'NodeStatus', + 'OnboardingStatus', + 'OperationOrigin', + 'StopMode', + 'UsageCount', + 'VirtualMachineStatus', +] diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/models/_models.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/models/_models.py new file mode 100644 index 000000000000..ac556e248b9a --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/models/_models.py @@ -0,0 +1,1870 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class AvailableOperation(msrest.serialization.Model): + """Resource provider available operation model. + + :param display: The list of operations. + :type display: ~azure.mgmt.vmwarecloudsimple.models.AvailableOperationDisplay + :param is_data_action: Indicating whether the operation is a data action or not. + :type is_data_action: bool + :param name: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}. + :type name: str + :param origin: The origin of operation. Possible values include: "user", "system", + "user,system". + :type origin: str or ~azure.mgmt.vmwarecloudsimple.models.OperationOrigin + :param service_specification: The list of specification's service metrics. + :type service_specification: + ~azure.mgmt.vmwarecloudsimple.models.AvailableOperationDisplayPropertyServiceSpecificationMetricsList + """ + + _attribute_map = { + 'display': {'key': 'display', 'type': 'AvailableOperationDisplay'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'AvailableOperationDisplayPropertyServiceSpecificationMetricsList'}, + } + + def __init__( + self, + **kwargs + ): + super(AvailableOperation, self).__init__(**kwargs) + self.display = kwargs.get('display', None) + self.is_data_action = kwargs.get('is_data_action', False) + self.name = kwargs.get('name', None) + self.origin = kwargs.get('origin', None) + self.service_specification = kwargs.get('service_specification', None) + + +class AvailableOperationDisplay(msrest.serialization.Model): + """Resource provider available operation display model. + + :param description: Description of the operation for display purposes. + :type description: str + :param operation: Name of the operation for display purposes. + :type operation: str + :param provider: Name of the provider for display purposes. + :type provider: str + :param resource: Name of the resource type for display purposes. + :type resource: str + """ + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AvailableOperationDisplay, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.operation = kwargs.get('operation', None) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + + +class AvailableOperationDisplayPropertyServiceSpecificationMetricsItem(msrest.serialization.Model): + """Available operation display property service specification metrics item. + + All required parameters must be populated in order to send to Azure. + + :param aggregation_type: Required. Metric's aggregation type for e.g. (Average, Total). + Possible values include: "Average", "Total". + :type aggregation_type: str or ~azure.mgmt.vmwarecloudsimple.models.AggregationType + :param display_description: Required. Metric's description. + :type display_description: str + :param display_name: Required. Human readable metric's name. + :type display_name: str + :param name: Required. Metric's name/id. + :type name: str + :param unit: Required. Metric's unit. + :type unit: str + """ + + _validation = { + 'aggregation_type': {'required': True}, + 'display_description': {'required': True}, + 'display_name': {'required': True}, + 'name': {'required': True}, + 'unit': {'required': True}, + } + + _attribute_map = { + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AvailableOperationDisplayPropertyServiceSpecificationMetricsItem, self).__init__(**kwargs) + self.aggregation_type = kwargs['aggregation_type'] + self.display_description = kwargs['display_description'] + self.display_name = kwargs['display_name'] + self.name = kwargs['name'] + self.unit = kwargs['unit'] + + +class AvailableOperationDisplayPropertyServiceSpecificationMetricsList(msrest.serialization.Model): + """List of available operation display property service specification metrics. + + :param metric_specifications: Metric specifications of operation. + :type metric_specifications: + list[~azure.mgmt.vmwarecloudsimple.models.AvailableOperationDisplayPropertyServiceSpecificationMetricsItem] + """ + + _attribute_map = { + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[AvailableOperationDisplayPropertyServiceSpecificationMetricsItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(AvailableOperationDisplayPropertyServiceSpecificationMetricsList, self).__init__(**kwargs) + self.metric_specifications = kwargs.get('metric_specifications', None) + + +class AvailableOperationsListResponse(msrest.serialization.Model): + """List of available operations. + + :param next_link: Link for next list of available operations. + :type next_link: str + :param value: Returns a list of available operations. + :type value: list[~azure.mgmt.vmwarecloudsimple.models.AvailableOperation] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[AvailableOperation]'}, + } + + def __init__( + self, + **kwargs + ): + super(AvailableOperationsListResponse, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) + + +class CSRPError(msrest.serialization.Model): + """General error model. + + :param error: Error's body. + :type error: ~azure.mgmt.vmwarecloudsimple.models.CSRPErrorBody + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'CSRPErrorBody'}, + } + + def __init__( + self, + **kwargs + ): + super(CSRPError, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class CSRPErrorBody(msrest.serialization.Model): + """Error properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error's code. + :vartype code: str + :ivar details: Error's details. + :vartype details: list[~azure.mgmt.vmwarecloudsimple.models.CSRPErrorBody] + :ivar message: Error's message. + :vartype message: str + :param target: Error's target. + :type target: str + """ + + _validation = { + 'code': {'readonly': True}, + 'details': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CSRPErrorBody]'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CSRPErrorBody, self).__init__(**kwargs) + self.code = None + self.details = None + self.message = None + self.target = kwargs.get('target', None) + + +class CustomizationHostName(msrest.serialization.Model): + """Host name model. + + :param name: Hostname. + :type name: str + :param type: Type of host name. Possible values include: "USER_DEFINED", "PREFIX_BASED", + "FIXED", "VIRTUAL_MACHINE_NAME", "CUSTOM_NAME". + :type type: str or ~azure.mgmt.vmwarecloudsimple.models.CustomizationHostNameType + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomizationHostName, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + + +class CustomizationIdentity(msrest.serialization.Model): + """CustomizationIdentity. + + :param data: Windows Text Identity. Prepared data. + :type data: str + :param host_name: Virtual machine host name settings. + :type host_name: ~azure.mgmt.vmwarecloudsimple.models.CustomizationHostName + :param type: Identity type. Possible values include: "WINDOWS_TEXT", "WINDOWS", "LINUX". + :type type: str or ~azure.mgmt.vmwarecloudsimple.models.CustomizationIdentityType + :param user_data: Windows Identity. User data customization. + :type user_data: ~azure.mgmt.vmwarecloudsimple.models.CustomizationIdentityUserData + """ + + _attribute_map = { + 'data': {'key': 'data', 'type': 'str'}, + 'host_name': {'key': 'hostName', 'type': 'CustomizationHostName'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_data': {'key': 'userData', 'type': 'CustomizationIdentityUserData'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomizationIdentity, self).__init__(**kwargs) + self.data = kwargs.get('data', None) + self.host_name = kwargs.get('host_name', None) + self.type = kwargs.get('type', None) + self.user_data = kwargs.get('user_data', None) + + +class CustomizationIdentityUserData(msrest.serialization.Model): + """Windows Identity. User data customization. + + :param is_password_predefined: Is password predefined in customization policy. + :type is_password_predefined: bool + """ + + _attribute_map = { + 'is_password_predefined': {'key': 'isPasswordPredefined', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomizationIdentityUserData, self).__init__(**kwargs) + self.is_password_predefined = kwargs.get('is_password_predefined', False) + + +class CustomizationIPAddress(msrest.serialization.Model): + """CustomizationIPAddress. + + :param argument: Argument when Custom ip type is selected. + :type argument: str + :param ip_address: Defined Ip Address when Fixed ip type is selected. + :type ip_address: str + :param type: Customization Specification ip type. Possible values include: "CUSTOM", "DHCP_IP", + "FIXED_IP", "USER_DEFINED". + :type type: str or ~azure.mgmt.vmwarecloudsimple.models.CustomizationIPAddressType + """ + + _attribute_map = { + 'argument': {'key': 'argument', 'type': 'str'}, + 'ip_address': {'key': 'ipAddress', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomizationIPAddress, self).__init__(**kwargs) + self.argument = kwargs.get('argument', None) + self.ip_address = kwargs.get('ip_address', None) + self.type = kwargs.get('type', None) + + +class CustomizationIPSettings(msrest.serialization.Model): + """CustomizationIPSettings. + + :param gateway: The list of gateways. + :type gateway: list[str] + :param ip: Ip address customization settings. + :type ip: ~azure.mgmt.vmwarecloudsimple.models.CustomizationIPAddress + :param subnet_mask: Adapter subnet mask. + :type subnet_mask: str + """ + + _attribute_map = { + 'gateway': {'key': 'gateway', 'type': '[str]'}, + 'ip': {'key': 'ip', 'type': 'CustomizationIPAddress'}, + 'subnet_mask': {'key': 'subnetMask', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomizationIPSettings, self).__init__(**kwargs) + self.gateway = kwargs.get('gateway', None) + self.ip = kwargs.get('ip', None) + self.subnet_mask = kwargs.get('subnet_mask', None) + + +class CustomizationNicSetting(msrest.serialization.Model): + """CustomizationNicSetting. + + :param adapter: The list of adapters' settings. + :type adapter: ~azure.mgmt.vmwarecloudsimple.models.CustomizationIPSettings + :param mac_address: NIC mac address. + :type mac_address: str + """ + + _attribute_map = { + 'adapter': {'key': 'adapter', 'type': 'CustomizationIPSettings'}, + 'mac_address': {'key': 'macAddress', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomizationNicSetting, self).__init__(**kwargs) + self.adapter = kwargs.get('adapter', None) + self.mac_address = kwargs.get('mac_address', None) + + +class CustomizationPoliciesListResponse(msrest.serialization.Model): + """List of customization polices response model. + + :param next_link: Link for next list of the Customization policy. + :type next_link: str + :param value: List of the customization policies. + :type value: list[~azure.mgmt.vmwarecloudsimple.models.CustomizationPolicy] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[CustomizationPolicy]'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomizationPoliciesListResponse, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) + + +class CustomizationPolicy(msrest.serialization.Model): + """The virtual machine customization policy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: Customization policy azure id. + :type id: str + :param location: Azure region. + :type location: str + :ivar name: Customization policy name. + :vartype name: str + :ivar type: + :vartype type: str + :param description: Policy description. + :type description: str + :param private_cloud_id: The Private cloud id. + :type private_cloud_id: str + :param specification: Detailed customization policy specification. + :type specification: ~azure.mgmt.vmwarecloudsimple.models.CustomizationSpecification + :param type_properties_type: The type of customization (Linux or Windows). Possible values + include: "LINUX", "WINDOWS". + :type type_properties_type: str or + ~azure.mgmt.vmwarecloudsimple.models.CustomizationPolicyPropertiesType + :param version: Policy version. + :type version: str + """ + + _validation = { + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'private_cloud_id': {'key': 'properties.privateCloudId', 'type': 'str'}, + 'specification': {'key': 'properties.specification', 'type': 'CustomizationSpecification'}, + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomizationPolicy, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.location = kwargs.get('location', None) + self.name = None + self.type = None + self.description = kwargs.get('description', None) + self.private_cloud_id = kwargs.get('private_cloud_id', None) + self.specification = kwargs.get('specification', None) + self.type_properties_type = kwargs.get('type_properties_type', None) + self.version = kwargs.get('version', None) + + +class CustomizationSpecification(msrest.serialization.Model): + """The specification for Customization Policy. + + :param identity: Customization Identity. It contains data about user and hostname. + :type identity: ~azure.mgmt.vmwarecloudsimple.models.CustomizationIdentity + :param nic_settings: Network interface settings. + :type nic_settings: list[~azure.mgmt.vmwarecloudsimple.models.CustomizationNicSetting] + """ + + _attribute_map = { + 'identity': {'key': 'identity', 'type': 'CustomizationIdentity'}, + 'nic_settings': {'key': 'nicSettings', 'type': '[CustomizationNicSetting]'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomizationSpecification, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) + self.nic_settings = kwargs.get('nic_settings', None) + + +class DedicatedCloudNode(msrest.serialization.Model): + """Dedicated cloud node model. + + 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: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/dedicatedCloudNodes/{dedicatedCloudNodeName}. + :vartype id: str + :param location: Required. Azure region. + :type location: str + :ivar name: {dedicatedCloudNodeName}. + :vartype name: str + :param sku: Dedicated Cloud Nodes SKU. + :type sku: ~azure.mgmt.vmwarecloudsimple.models.Sku + :param tags: A set of tags. Dedicated Cloud Nodes tags. + :type tags: dict[str, str] + :ivar type: {resourceProviderNamespace}/{resourceType}. + :vartype type: str + :param availability_zone_id: Availability Zone id, e.g. "az1". + :type availability_zone_id: str + :ivar availability_zone_name: Availability Zone name, e.g. "Availability Zone 1". + :vartype availability_zone_name: str + :ivar cloud_rack_name: VMWare Cloud Rack Name. + :vartype cloud_rack_name: str + :ivar created: date time the resource was created. + :vartype created: any + :param nodes_count: count of nodes to create. + :type nodes_count: int + :param placement_group_id: Placement Group id, e.g. "n1". + :type placement_group_id: str + :ivar placement_group_name: Placement Name, e.g. "Placement Group 1". + :vartype placement_group_name: str + :ivar private_cloud_id: Private Cloud Id. + :vartype private_cloud_id: str + :ivar private_cloud_name: Resource Pool Name. + :vartype private_cloud_name: str + :ivar provisioning_state: The provisioning status of the resource. + :vartype provisioning_state: str + :param purchase_id: purchase id. + :type purchase_id: str + :ivar status: Node status, indicates is private cloud set up on this node or not. Possible + values include: "unused", "used". + :vartype status: str or ~azure.mgmt.vmwarecloudsimple.models.NodeStatus + :ivar vmware_cluster_name: VMWare Cluster Name. + :vartype vmware_cluster_name: str + :param id_properties_sku_description_id: SKU's id. + :type id_properties_sku_description_id: str + :param name_properties_sku_description_name: SKU's name. + :type name_properties_sku_description_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'location': {'required': True}, + 'name': {'readonly': True, 'pattern': r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'}, + 'type': {'readonly': True}, + 'availability_zone_name': {'readonly': True}, + 'cloud_rack_name': {'readonly': True}, + 'created': {'readonly': True}, + 'placement_group_name': {'readonly': True}, + 'private_cloud_id': {'readonly': True}, + 'private_cloud_name': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'vmware_cluster_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'type': {'key': 'type', 'type': 'str'}, + 'availability_zone_id': {'key': 'properties.availabilityZoneId', 'type': 'str'}, + 'availability_zone_name': {'key': 'properties.availabilityZoneName', 'type': 'str'}, + 'cloud_rack_name': {'key': 'properties.cloudRackName', 'type': 'str'}, + 'created': {'key': 'properties.created', 'type': 'object'}, + 'nodes_count': {'key': 'properties.nodesCount', 'type': 'int'}, + 'placement_group_id': {'key': 'properties.placementGroupId', 'type': 'str'}, + 'placement_group_name': {'key': 'properties.placementGroupName', 'type': 'str'}, + 'private_cloud_id': {'key': 'properties.privateCloudId', 'type': 'str'}, + 'private_cloud_name': {'key': 'properties.privateCloudName', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'purchase_id': {'key': 'properties.purchaseId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'vmware_cluster_name': {'key': 'properties.vmwareClusterName', 'type': 'str'}, + 'id_properties_sku_description_id': {'key': 'properties.skuDescription.id', 'type': 'str'}, + 'name_properties_sku_description_name': {'key': 'properties.skuDescription.name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DedicatedCloudNode, self).__init__(**kwargs) + self.id = None + self.location = kwargs['location'] + self.name = None + self.sku = kwargs.get('sku', None) + self.tags = kwargs.get('tags', None) + self.type = None + self.availability_zone_id = kwargs.get('availability_zone_id', None) + self.availability_zone_name = None + self.cloud_rack_name = None + self.created = None + self.nodes_count = kwargs.get('nodes_count', None) + self.placement_group_id = kwargs.get('placement_group_id', None) + self.placement_group_name = None + self.private_cloud_id = None + self.private_cloud_name = None + self.provisioning_state = None + self.purchase_id = kwargs.get('purchase_id', None) + self.status = None + self.vmware_cluster_name = None + self.id_properties_sku_description_id = kwargs.get('id_properties_sku_description_id', None) + self.name_properties_sku_description_name = kwargs.get('name_properties_sku_description_name', None) + + +class DedicatedCloudNodeListResponse(msrest.serialization.Model): + """List of dedicated nodes response model. + + :param next_link: Link for next list of DedicatedCloudNode. + :type next_link: str + :param value: Results of the DedicatedCloudNode list. + :type value: list[~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudNode] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[DedicatedCloudNode]'}, + } + + def __init__( + self, + **kwargs + ): + super(DedicatedCloudNodeListResponse, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) + + +class DedicatedCloudService(msrest.serialization.Model): + """Dedicated cloud service model. + + 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: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/dedicatedCloudServices/{dedicatedCloudServiceName}. + :vartype id: str + :param location: Required. Azure region. + :type location: str + :ivar name: {dedicatedCloudServiceName}. + :vartype name: str + :param tags: A set of tags. The list of tags. + :type tags: dict[str, str] + :ivar type: {resourceProviderNamespace}/{resourceType}. + :vartype type: str + :param gateway_subnet: gateway Subnet for the account. It will collect the subnet address and + always treat it as /28. + :type gateway_subnet: str + :ivar is_account_onboarded: indicates whether account onboarded or not in a given region. + Possible values include: "notOnBoarded", "onBoarded", "onBoardingFailed", "onBoarding". + :vartype is_account_onboarded: str or ~azure.mgmt.vmwarecloudsimple.models.OnboardingStatus + :ivar nodes: total nodes purchased. + :vartype nodes: int + :ivar service_url: link to a service management web portal. + :vartype service_url: str + """ + + _validation = { + 'id': {'readonly': True}, + 'location': {'required': True}, + 'name': {'readonly': True, 'pattern': r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'}, + 'type': {'readonly': True}, + 'is_account_onboarded': {'readonly': True}, + 'nodes': {'readonly': True}, + 'service_url': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'type': {'key': 'type', 'type': 'str'}, + 'gateway_subnet': {'key': 'properties.gatewaySubnet', 'type': 'str'}, + 'is_account_onboarded': {'key': 'properties.isAccountOnboarded', 'type': 'str'}, + 'nodes': {'key': 'properties.nodes', 'type': 'int'}, + 'service_url': {'key': 'properties.serviceURL', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DedicatedCloudService, self).__init__(**kwargs) + self.id = None + self.location = kwargs['location'] + self.name = None + self.tags = kwargs.get('tags', None) + self.type = None + self.gateway_subnet = kwargs.get('gateway_subnet', None) + self.is_account_onboarded = None + self.nodes = None + self.service_url = None + + +class DedicatedCloudServiceListResponse(msrest.serialization.Model): + """List of dedicated cloud services. + + :param next_link: Link for next list of DedicatedCloudNode. + :type next_link: str + :param value: Results of the DedicatedCloudService list. + :type value: list[~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudService] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[DedicatedCloudService]'}, + } + + def __init__( + self, + **kwargs + ): + super(DedicatedCloudServiceListResponse, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) + + +class GuestOSCustomization(msrest.serialization.Model): + """Guest OS Customization properties. + + :param dns_servers: List of dns servers to use. + :type dns_servers: list[str] + :param host_name: Virtual Machine hostname. + :type host_name: str + :param password: Password for login. + :type password: str + :param policy_id: id of customization policy. + :type policy_id: str + :param username: Username for login. + :type username: str + """ + + _attribute_map = { + 'dns_servers': {'key': 'dnsServers', 'type': '[str]'}, + 'host_name': {'key': 'hostName', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + 'policy_id': {'key': 'policyId', 'type': 'str'}, + 'username': {'key': 'username', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GuestOSCustomization, self).__init__(**kwargs) + self.dns_servers = kwargs.get('dns_servers', None) + self.host_name = kwargs.get('host_name', None) + self.password = kwargs.get('password', None) + self.policy_id = kwargs.get('policy_id', None) + self.username = kwargs.get('username', None) + + +class GuestOSNICCustomization(msrest.serialization.Model): + """Guest OS nic customization. + + :param allocation: IP address allocation method. Possible values include: "static", "dynamic". + :type allocation: str or ~azure.mgmt.vmwarecloudsimple.models.GuestOSNICCustomizationAllocation + :param dns_servers: List of dns servers to use. + :type dns_servers: list[str] + :param gateway: Gateway addresses assigned to nic. + :type gateway: list[str] + :param ip_address: Static ip address for nic. + :type ip_address: str + :param mask: Network mask for nic. + :type mask: str + :param primary_wins_server: primary WINS server for Windows. + :type primary_wins_server: str + :param secondary_wins_server: secondary WINS server for Windows. + :type secondary_wins_server: str + """ + + _validation = { + 'ip_address': {'pattern': r'^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])[.]){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'}, + 'mask': {'pattern': r'^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])[.]){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'}, + 'primary_wins_server': {'pattern': r'^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])[.]){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'}, + 'secondary_wins_server': {'pattern': r'^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])[.]){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'}, + } + + _attribute_map = { + 'allocation': {'key': 'allocation', 'type': 'str'}, + 'dns_servers': {'key': 'dnsServers', 'type': '[str]'}, + 'gateway': {'key': 'gateway', 'type': '[str]'}, + 'ip_address': {'key': 'ipAddress', 'type': 'str'}, + 'mask': {'key': 'mask', 'type': 'str'}, + 'primary_wins_server': {'key': 'primaryWinsServer', 'type': 'str'}, + 'secondary_wins_server': {'key': 'secondaryWinsServer', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GuestOSNICCustomization, self).__init__(**kwargs) + self.allocation = kwargs.get('allocation', None) + self.dns_servers = kwargs.get('dns_servers', None) + self.gateway = kwargs.get('gateway', None) + self.ip_address = kwargs.get('ip_address', None) + self.mask = kwargs.get('mask', None) + self.primary_wins_server = kwargs.get('primary_wins_server', None) + self.secondary_wins_server = kwargs.get('secondary_wins_server', None) + + +class OperationError(msrest.serialization.Model): + """Operation error model. + + :param code: Error's code. + :type code: str + :param message: Error's message. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationError, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class OperationResource(msrest.serialization.Model): + """Operation status response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar end_time: End time of the operation. + :vartype end_time: ~datetime.datetime + :param error: Error Message if operation failed. + :type error: ~azure.mgmt.vmwarecloudsimple.models.OperationError + :ivar id: Operation Id. + :vartype id: str + :ivar name: Operation ID. + :vartype name: str + :ivar start_time: Start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar status: Operation status. + :vartype status: str + """ + + _validation = { + 'end_time': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'start_time': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'error': {'key': 'error', 'type': 'OperationError'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationResource, self).__init__(**kwargs) + self.end_time = None + self.error = kwargs.get('error', None) + self.id = None + self.name = None + self.start_time = None + self.status = None + + +class PatchPayload(msrest.serialization.Model): + """General patch payload modal. + + :param tags: A set of tags. The tags key:value pairs. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(PatchPayload, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class PrivateCloud(msrest.serialization.Model): + """Private cloud model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: Azure Id, e.g. + "/subscriptions/4da99247-a172-4ed6-8ae9-ebed2d12f839/providers/Microsoft.VMwareCloudSimple/privateClouds/cloud123". + :type id: str + :param location: Location where private cloud created, e.g "westus". + :type location: str + :param name: Private cloud name. + :type name: str + :ivar type: Azure Resource type. Default value: "Microsoft.VMwareCloudSimple/privateClouds". + :vartype type: str + :param availability_zone_id: Availability Zone id, e.g. "az1". + :type availability_zone_id: str + :param availability_zone_name: Availability Zone name, e.g. "Availability Zone 1". + :type availability_zone_name: str + :param clusters_number: Number of clusters. + :type clusters_number: int + :param created_by: User's emails who created cloud. + :type created_by: str + :param created_on: When private cloud was created. + :type created_on: ~datetime.datetime + :param dns_servers: Array of DNS servers. + :type dns_servers: list[str] + :param expires: Expiration date of PC. + :type expires: str + :param nsx_type: Nsx Type, e.g. "Advanced". + :type nsx_type: str + :param placement_group_id: Placement Group id, e.g. "n1". + :type placement_group_id: str + :param placement_group_name: Placement Group name. + :type placement_group_name: str + :param private_cloud_id: Id of a private cloud. + :type private_cloud_id: str + :param resource_pools: The list of Resource Pools. + :type resource_pools: list[~azure.mgmt.vmwarecloudsimple.models.ResourcePool] + :param state: Private Cloud state, e.g. "operational". + :type state: str + :param total_cpu_cores: Number of cores. + :type total_cpu_cores: int + :param total_nodes: Number of nodes. + :type total_nodes: int + :param total_ram: Memory size. + :type total_ram: int + :param total_storage: Disk space in TB. + :type total_storage: float + :param type_properties_type: Virtualization type e.g. "vSphere". + :type type_properties_type: str + :param v_sphere_version: e.g. "6.5u2". + :type v_sphere_version: str + :param vcenter_fqdn: FQDN for vcenter access. + :type vcenter_fqdn: str + :param vcenter_refid: Vcenter ip address. + :type vcenter_refid: str + :param virtual_machine_templates: The list of Virtual Machine Templates. + :type virtual_machine_templates: + list[~azure.mgmt.vmwarecloudsimple.models.VirtualMachineTemplate] + :param virtual_networks: The list of Virtual Networks. + :type virtual_networks: list[~azure.mgmt.vmwarecloudsimple.models.VirtualNetwork] + :param vr_ops_enabled: Is Vrops enabled/disabled. + :type vr_ops_enabled: bool + """ + + _validation = { + 'type': {'constant': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'availability_zone_id': {'key': 'properties.availabilityZoneId', 'type': 'str'}, + 'availability_zone_name': {'key': 'properties.availabilityZoneName', 'type': 'str'}, + 'clusters_number': {'key': 'properties.clustersNumber', 'type': 'int'}, + 'created_by': {'key': 'properties.createdBy', 'type': 'str'}, + 'created_on': {'key': 'properties.createdOn', 'type': 'iso-8601'}, + 'dns_servers': {'key': 'properties.dnsServers', 'type': '[str]'}, + 'expires': {'key': 'properties.expires', 'type': 'str'}, + 'nsx_type': {'key': 'properties.nsxType', 'type': 'str'}, + 'placement_group_id': {'key': 'properties.placementGroupId', 'type': 'str'}, + 'placement_group_name': {'key': 'properties.placementGroupName', 'type': 'str'}, + 'private_cloud_id': {'key': 'properties.privateCloudId', 'type': 'str'}, + 'resource_pools': {'key': 'properties.resourcePools', 'type': '[ResourcePool]'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'total_cpu_cores': {'key': 'properties.totalCpuCores', 'type': 'int'}, + 'total_nodes': {'key': 'properties.totalNodes', 'type': 'int'}, + 'total_ram': {'key': 'properties.totalRam', 'type': 'int'}, + 'total_storage': {'key': 'properties.totalStorage', 'type': 'float'}, + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, + 'v_sphere_version': {'key': 'properties.vSphereVersion', 'type': 'str'}, + 'vcenter_fqdn': {'key': 'properties.vcenterFqdn', 'type': 'str'}, + 'vcenter_refid': {'key': 'properties.vcenterRefid', 'type': 'str'}, + 'virtual_machine_templates': {'key': 'properties.virtualMachineTemplates', 'type': '[VirtualMachineTemplate]'}, + 'virtual_networks': {'key': 'properties.virtualNetworks', 'type': '[VirtualNetwork]'}, + 'vr_ops_enabled': {'key': 'properties.vrOpsEnabled', 'type': 'bool'}, + } + + type = "Microsoft.VMwareCloudSimple/privateClouds" + + def __init__( + self, + **kwargs + ): + super(PrivateCloud, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.location = kwargs.get('location', None) + self.name = kwargs.get('name', None) + self.availability_zone_id = kwargs.get('availability_zone_id', None) + self.availability_zone_name = kwargs.get('availability_zone_name', None) + self.clusters_number = kwargs.get('clusters_number', None) + self.created_by = kwargs.get('created_by', None) + self.created_on = kwargs.get('created_on', None) + self.dns_servers = kwargs.get('dns_servers', None) + self.expires = kwargs.get('expires', None) + self.nsx_type = kwargs.get('nsx_type', None) + self.placement_group_id = kwargs.get('placement_group_id', None) + self.placement_group_name = kwargs.get('placement_group_name', None) + self.private_cloud_id = kwargs.get('private_cloud_id', None) + self.resource_pools = kwargs.get('resource_pools', None) + self.state = kwargs.get('state', None) + self.total_cpu_cores = kwargs.get('total_cpu_cores', None) + self.total_nodes = kwargs.get('total_nodes', None) + self.total_ram = kwargs.get('total_ram', None) + self.total_storage = kwargs.get('total_storage', None) + self.type_properties_type = kwargs.get('type_properties_type', None) + self.v_sphere_version = kwargs.get('v_sphere_version', None) + self.vcenter_fqdn = kwargs.get('vcenter_fqdn', None) + self.vcenter_refid = kwargs.get('vcenter_refid', None) + self.virtual_machine_templates = kwargs.get('virtual_machine_templates', None) + self.virtual_networks = kwargs.get('virtual_networks', None) + self.vr_ops_enabled = kwargs.get('vr_ops_enabled', None) + + +class PrivateCloudList(msrest.serialization.Model): + """List of private clouds. + + :param next_link: Link for next list of Private Clouds. + :type next_link: str + :param value: the list of private clouds. + :type value: list[~azure.mgmt.vmwarecloudsimple.models.PrivateCloud] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[PrivateCloud]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateCloudList, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) + + +class ResourcePool(msrest.serialization.Model): + """Resource pool model. + + 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 id: Required. resource pool id (privateCloudId:vsphereId). + :type id: str + :ivar location: Azure region. + :vartype location: str + :ivar name: {ResourcePoolName}. + :vartype name: str + :ivar private_cloud_id: The Private Cloud Id. + :vartype private_cloud_id: str + :ivar type: {resourceProviderNamespace}/{resourceType}. + :vartype type: str + :ivar full_name: Hierarchical resource pool name. + :vartype full_name: str + """ + + _validation = { + 'id': {'required': True}, + 'location': {'readonly': True}, + 'name': {'readonly': True}, + 'private_cloud_id': {'readonly': True}, + 'type': {'readonly': True}, + 'full_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'private_cloud_id': {'key': 'privateCloudId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'full_name': {'key': 'properties.fullName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourcePool, self).__init__(**kwargs) + self.id = kwargs['id'] + self.location = None + self.name = None + self.private_cloud_id = None + self.type = None + self.full_name = None + + +class ResourcePoolsListResponse(msrest.serialization.Model): + """List of resource pools response model. + + :param next_link: Link for next list of ResourcePoolsList. + :type next_link: str + :param value: Results of the Resource pools list. + :type value: list[~azure.mgmt.vmwarecloudsimple.models.ResourcePool] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[ResourcePool]'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourcePoolsListResponse, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) + + +class Sku(msrest.serialization.Model): + """The purchase SKU for CloudSimple paid resources. + + All required parameters must be populated in order to send to Azure. + + :param capacity: The capacity of the SKU. + :type capacity: str + :param description: dedicatedCloudNode example: 8 x Ten-Core Intel® Xeon® Processor E5-2640 v4 + 2.40GHz 25MB Cache (90W); 12 x 64GB PC4-19200 2400MHz DDR4 ECC Registered DIMM, ... + :type description: str + :param family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :type family: str + :param name: Required. The name of the SKU for VMWare CloudSimple Node. + :type name: str + :param tier: The tier of the SKU. + :type tier: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'capacity': {'key': 'capacity', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.capacity = kwargs.get('capacity', None) + self.description = kwargs.get('description', None) + self.family = kwargs.get('family', None) + self.name = kwargs['name'] + self.tier = kwargs.get('tier', None) + + +class SkuAvailability(msrest.serialization.Model): + """SKU availability model. + + All required parameters must be populated in order to send to Azure. + + :param dedicated_availability_zone_id: CloudSimple Availability Zone id. + :type dedicated_availability_zone_id: str + :param dedicated_availability_zone_name: CloudSimple Availability Zone Name. + :type dedicated_availability_zone_name: str + :param dedicated_placement_group_id: CloudSimple Placement Group Id. + :type dedicated_placement_group_id: str + :param dedicated_placement_group_name: CloudSimple Placement Group name. + :type dedicated_placement_group_name: str + :param limit: Required. indicates how many resources of a given SKU is available in a AZ->PG. + :type limit: int + :param resource_type: resource type e.g. DedicatedCloudNodes. + :type resource_type: str + :param sku_id: sku id. + :type sku_id: str + :param sku_name: sku name. + :type sku_name: str + """ + + _validation = { + 'limit': {'required': True}, + } + + _attribute_map = { + 'dedicated_availability_zone_id': {'key': 'dedicatedAvailabilityZoneId', 'type': 'str'}, + 'dedicated_availability_zone_name': {'key': 'dedicatedAvailabilityZoneName', 'type': 'str'}, + 'dedicated_placement_group_id': {'key': 'dedicatedPlacementGroupId', 'type': 'str'}, + 'dedicated_placement_group_name': {'key': 'dedicatedPlacementGroupName', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'sku_id': {'key': 'skuId', 'type': 'str'}, + 'sku_name': {'key': 'skuName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SkuAvailability, self).__init__(**kwargs) + self.dedicated_availability_zone_id = kwargs.get('dedicated_availability_zone_id', None) + self.dedicated_availability_zone_name = kwargs.get('dedicated_availability_zone_name', None) + self.dedicated_placement_group_id = kwargs.get('dedicated_placement_group_id', None) + self.dedicated_placement_group_name = kwargs.get('dedicated_placement_group_name', None) + self.limit = kwargs['limit'] + self.resource_type = kwargs.get('resource_type', None) + self.sku_id = kwargs.get('sku_id', None) + self.sku_name = kwargs.get('sku_name', None) + + +class SkuAvailabilityListResponse(msrest.serialization.Model): + """List of SKU availabilities. + + :param next_link: Link for next list of DedicatedCloudNode. + :type next_link: str + :param value: Results of the DedicatedPlacementGroupSkuAvailability list. + :type value: list[~azure.mgmt.vmwarecloudsimple.models.SkuAvailability] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[SkuAvailability]'}, + } + + def __init__( + self, + **kwargs + ): + super(SkuAvailabilityListResponse, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) + + +class Usage(msrest.serialization.Model): + """Usage model. + + All required parameters must be populated in order to send to Azure. + + :param current_value: Required. The current usage value. + :type current_value: int + :param limit: Required. limit of a given sku in a region for a subscription. The maximum + permitted value for the usage quota. If there is no limit, this value will be -1. + :type limit: int + :param name: Usage name value and localized name. + :type name: ~azure.mgmt.vmwarecloudsimple.models.UsageName + :param unit: The usages' unit. Possible values include: "Count", "Bytes", "Seconds", "Percent", + "CountPerSecond", "BytesPerSecond". + :type unit: str or ~azure.mgmt.vmwarecloudsimple.models.UsageCount + """ + + _validation = { + 'current_value': {'required': True}, + 'limit': {'required': True}, + } + + _attribute_map = { + 'current_value': {'key': 'currentValue', 'type': 'int'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'UsageName'}, + 'unit': {'key': 'unit', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Usage, self).__init__(**kwargs) + self.current_value = kwargs['current_value'] + self.limit = kwargs['limit'] + self.name = kwargs.get('name', None) + self.unit = kwargs.get('unit', None) + + +class UsageListResponse(msrest.serialization.Model): + """List of usages. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param next_link: Link for next list of DedicatedCloudNode. + :type next_link: str + :ivar value: The list of usages. + :vartype value: list[~azure.mgmt.vmwarecloudsimple.models.Usage] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Usage]'}, + } + + def __init__( + self, + **kwargs + ): + super(UsageListResponse, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = None + + +class UsageName(msrest.serialization.Model): + """User name model. + + :param localized_value: e.g. "Virtual Machines". + :type localized_value: str + :param value: resource type or resource type sku name, e.g. virtualMachines. + :type value: str + """ + + _attribute_map = { + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UsageName, self).__init__(**kwargs) + self.localized_value = kwargs.get('localized_value', None) + self.value = kwargs.get('value', None) + + +class VirtualDisk(msrest.serialization.Model): + """Virtual disk model. + + 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 controller_id: Required. Disk's Controller id. + :type controller_id: str + :param independence_mode: Required. Disk's independence mode type. Possible values include: + "persistent", "independent_persistent", "independent_nonpersistent". + :type independence_mode: str or ~azure.mgmt.vmwarecloudsimple.models.DiskIndependenceMode + :param total_size: Required. Disk's total size. + :type total_size: int + :param virtual_disk_id: Disk's id. + :type virtual_disk_id: str + :ivar virtual_disk_name: Disk's display name. + :vartype virtual_disk_name: str + """ + + _validation = { + 'controller_id': {'required': True}, + 'independence_mode': {'required': True}, + 'total_size': {'required': True}, + 'virtual_disk_name': {'readonly': True}, + } + + _attribute_map = { + 'controller_id': {'key': 'controllerId', 'type': 'str'}, + 'independence_mode': {'key': 'independenceMode', 'type': 'str'}, + 'total_size': {'key': 'totalSize', 'type': 'int'}, + 'virtual_disk_id': {'key': 'virtualDiskId', 'type': 'str'}, + 'virtual_disk_name': {'key': 'virtualDiskName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualDisk, self).__init__(**kwargs) + self.controller_id = kwargs['controller_id'] + self.independence_mode = kwargs['independence_mode'] + self.total_size = kwargs['total_size'] + self.virtual_disk_id = kwargs.get('virtual_disk_id', None) + self.virtual_disk_name = None + + +class VirtualDiskController(msrest.serialization.Model): + """Virtual disk controller model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Controller's id. + :vartype id: str + :ivar name: The display name of Controller. + :vartype name: str + :ivar sub_type: dik controller subtype (VMWARE_PARAVIRTUAL, BUS_PARALLEL, LSI_PARALLEL, + LSI_SAS). + :vartype sub_type: str + :ivar type: disk controller type (SCSI). + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'sub_type': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'sub_type': {'key': 'subType', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualDiskController, self).__init__(**kwargs) + self.id = None + self.name = None + self.sub_type = None + self.type = None + + +class VirtualMachine(msrest.serialization.Model): + """Virtual machine model. + + 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: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/virtualMachines/{virtualMachineName}. + :vartype id: str + :param location: Required. Azure region. + :type location: str + :ivar name: {virtualMachineName}. + :vartype name: str + :param tags: A set of tags. The list of tags. + :type tags: dict[str, str] + :ivar type: {resourceProviderNamespace}/{resourceType}. + :vartype type: str + :param amount_of_ram: The amount of memory. + :type amount_of_ram: int + :ivar controllers: The list of Virtual Disks' Controllers. + :vartype controllers: list[~azure.mgmt.vmwarecloudsimple.models.VirtualDiskController] + :param customization: Virtual machine properties. + :type customization: ~azure.mgmt.vmwarecloudsimple.models.GuestOSCustomization + :param disks: The list of Virtual Disks. + :type disks: list[~azure.mgmt.vmwarecloudsimple.models.VirtualDisk] + :ivar dnsname: The DNS name of Virtual Machine in VCenter. + :vartype dnsname: str + :param expose_to_guest_vm: Expose Guest OS or not. + :type expose_to_guest_vm: bool + :ivar folder: The path to virtual machine folder in VCenter. + :vartype folder: str + :ivar guest_os: The name of Guest OS. + :vartype guest_os: str + :ivar guest_os_type: The Guest OS type. Possible values include: "linux", "windows", "other". + :vartype guest_os_type: str or ~azure.mgmt.vmwarecloudsimple.models.GuestOSType + :param nics: The list of Virtual NICs. + :type nics: list[~azure.mgmt.vmwarecloudsimple.models.VirtualNic] + :param number_of_cores: The number of CPU cores. + :type number_of_cores: int + :param password: Password for login. Deprecated - use customization property. + :type password: str + :param private_cloud_id: Private Cloud Id. + :type private_cloud_id: str + :ivar provisioning_state: The provisioning status of the resource. + :vartype provisioning_state: str + :ivar public_ip: The public ip of Virtual Machine. + :vartype public_ip: str + :param resource_pool: Virtual Machines Resource Pool. + :type resource_pool: ~azure.mgmt.vmwarecloudsimple.models.ResourcePool + :ivar status: The status of Virtual machine. Possible values include: "running", "suspended", + "poweredoff", "updating", "deallocating", "deleting". + :vartype status: str or ~azure.mgmt.vmwarecloudsimple.models.VirtualMachineStatus + :param template_id: Virtual Machine Template Id. + :type template_id: str + :param username: Username for login. Deprecated - use customization property. + :type username: str + :param v_sphere_networks: The list of Virtual VSphere Networks. + :type v_sphere_networks: list[str] + :ivar vm_id: The internal id of Virtual Machine in VCenter. + :vartype vm_id: str + :ivar vmwaretools: VMware tools version. + :vartype vmwaretools: str + """ + + _validation = { + 'id': {'readonly': True}, + 'location': {'required': True}, + 'name': {'readonly': True, 'pattern': r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'}, + 'type': {'readonly': True}, + 'controllers': {'readonly': True}, + 'dnsname': {'readonly': True}, + 'folder': {'readonly': True}, + 'guest_os': {'readonly': True}, + 'guest_os_type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'public_ip': {'readonly': True}, + 'status': {'readonly': True}, + 'vm_id': {'readonly': True}, + 'vmwaretools': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'type': {'key': 'type', 'type': 'str'}, + 'amount_of_ram': {'key': 'properties.amountOfRam', 'type': 'int'}, + 'controllers': {'key': 'properties.controllers', 'type': '[VirtualDiskController]'}, + 'customization': {'key': 'properties.customization', 'type': 'GuestOSCustomization'}, + 'disks': {'key': 'properties.disks', 'type': '[VirtualDisk]'}, + 'dnsname': {'key': 'properties.dnsname', 'type': 'str'}, + 'expose_to_guest_vm': {'key': 'properties.exposeToGuestVM', 'type': 'bool'}, + 'folder': {'key': 'properties.folder', 'type': 'str'}, + 'guest_os': {'key': 'properties.guestOS', 'type': 'str'}, + 'guest_os_type': {'key': 'properties.guestOSType', 'type': 'str'}, + 'nics': {'key': 'properties.nics', 'type': '[VirtualNic]'}, + 'number_of_cores': {'key': 'properties.numberOfCores', 'type': 'int'}, + 'password': {'key': 'properties.password', 'type': 'str'}, + 'private_cloud_id': {'key': 'properties.privateCloudId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'public_ip': {'key': 'properties.publicIP', 'type': 'str'}, + 'resource_pool': {'key': 'properties.resourcePool', 'type': 'ResourcePool'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'template_id': {'key': 'properties.templateId', 'type': 'str'}, + 'username': {'key': 'properties.username', 'type': 'str'}, + 'v_sphere_networks': {'key': 'properties.vSphereNetworks', 'type': '[str]'}, + 'vm_id': {'key': 'properties.vmId', 'type': 'str'}, + 'vmwaretools': {'key': 'properties.vmwaretools', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachine, self).__init__(**kwargs) + self.id = None + self.location = kwargs['location'] + self.name = None + self.tags = kwargs.get('tags', None) + self.type = None + self.amount_of_ram = kwargs.get('amount_of_ram', None) + self.controllers = None + self.customization = kwargs.get('customization', None) + self.disks = kwargs.get('disks', None) + self.dnsname = None + self.expose_to_guest_vm = kwargs.get('expose_to_guest_vm', None) + self.folder = None + self.guest_os = None + self.guest_os_type = None + self.nics = kwargs.get('nics', None) + self.number_of_cores = kwargs.get('number_of_cores', None) + self.password = kwargs.get('password', None) + self.private_cloud_id = kwargs.get('private_cloud_id', None) + self.provisioning_state = None + self.public_ip = None + self.resource_pool = kwargs.get('resource_pool', None) + self.status = None + self.template_id = kwargs.get('template_id', None) + self.username = kwargs.get('username', None) + self.v_sphere_networks = kwargs.get('v_sphere_networks', None) + self.vm_id = None + self.vmwaretools = None + + +class VirtualMachineListResponse(msrest.serialization.Model): + """List of virtual machines. + + :param next_link: Link for next list of VirtualMachines. + :type next_link: str + :param value: Results of the VirtualMachine list. + :type value: list[~azure.mgmt.vmwarecloudsimple.models.VirtualMachine] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[VirtualMachine]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineListResponse, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) + + +class VirtualMachineStopMode(msrest.serialization.Model): + """List of virtual machine stop modes. + + :param mode: mode indicates a type of stop operation - reboot, suspend, shutdown or power-off. + Possible values include: "reboot", "suspend", "shutdown", "poweroff". + :type mode: str or ~azure.mgmt.vmwarecloudsimple.models.StopMode + """ + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineStopMode, self).__init__(**kwargs) + self.mode = kwargs.get('mode', None) + + +class VirtualMachineTemplate(msrest.serialization.Model): + """Virtual machine template model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: virtual machine template id (privateCloudId:vsphereId). + :vartype id: str + :param location: Azure region. + :type location: str + :ivar name: {virtualMachineTemplateName}. + :vartype name: str + :ivar type: {resourceProviderNamespace}/{resourceType}. + :vartype type: str + :param amount_of_ram: The amount of memory. + :type amount_of_ram: int + :param controllers: The list of Virtual Disk Controllers. + :type controllers: list[~azure.mgmt.vmwarecloudsimple.models.VirtualDiskController] + :param description: The description of Virtual Machine Template. + :type description: str + :param disks: The list of Virtual Disks. + :type disks: list[~azure.mgmt.vmwarecloudsimple.models.VirtualDisk] + :param expose_to_guest_vm: Expose Guest OS or not. + :type expose_to_guest_vm: bool + :ivar guest_os: The Guest OS. + :vartype guest_os: str + :ivar guest_os_type: The Guest OS types. + :vartype guest_os_type: str + :param nics: The list of Virtual NICs. + :type nics: list[~azure.mgmt.vmwarecloudsimple.models.VirtualNic] + :param number_of_cores: The number of CPU cores. + :type number_of_cores: int + :param path: path to folder. + :type path: str + :param private_cloud_id: The Private Cloud Id. + :type private_cloud_id: str + :param v_sphere_networks: The list of VSphere networks. + :type v_sphere_networks: list[str] + :param v_sphere_tags: The tags from VSphere. + :type v_sphere_tags: list[str] + :ivar vmwaretools: The VMware tools version. + :vartype vmwaretools: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'guest_os': {'readonly': True}, + 'guest_os_type': {'readonly': True}, + 'vmwaretools': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'amount_of_ram': {'key': 'properties.amountOfRam', 'type': 'int'}, + 'controllers': {'key': 'properties.controllers', 'type': '[VirtualDiskController]'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'disks': {'key': 'properties.disks', 'type': '[VirtualDisk]'}, + 'expose_to_guest_vm': {'key': 'properties.exposeToGuestVM', 'type': 'bool'}, + 'guest_os': {'key': 'properties.guestOS', 'type': 'str'}, + 'guest_os_type': {'key': 'properties.guestOSType', 'type': 'str'}, + 'nics': {'key': 'properties.nics', 'type': '[VirtualNic]'}, + 'number_of_cores': {'key': 'properties.numberOfCores', 'type': 'int'}, + 'path': {'key': 'properties.path', 'type': 'str'}, + 'private_cloud_id': {'key': 'properties.privateCloudId', 'type': 'str'}, + 'v_sphere_networks': {'key': 'properties.vSphereNetworks', 'type': '[str]'}, + 'v_sphere_tags': {'key': 'properties.vSphereTags', 'type': '[str]'}, + 'vmwaretools': {'key': 'properties.vmwaretools', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineTemplate, self).__init__(**kwargs) + self.id = None + self.location = kwargs.get('location', None) + self.name = None + self.type = None + self.amount_of_ram = kwargs.get('amount_of_ram', None) + self.controllers = kwargs.get('controllers', None) + self.description = kwargs.get('description', None) + self.disks = kwargs.get('disks', None) + self.expose_to_guest_vm = kwargs.get('expose_to_guest_vm', None) + self.guest_os = None + self.guest_os_type = None + self.nics = kwargs.get('nics', None) + self.number_of_cores = kwargs.get('number_of_cores', None) + self.path = kwargs.get('path', None) + self.private_cloud_id = kwargs.get('private_cloud_id', None) + self.v_sphere_networks = kwargs.get('v_sphere_networks', None) + self.v_sphere_tags = kwargs.get('v_sphere_tags', None) + self.vmwaretools = None + + +class VirtualMachineTemplateListResponse(msrest.serialization.Model): + """List of virtual machine templates. + + :param next_link: Link for next list of VirtualMachineTemplate. + :type next_link: str + :param value: Results of the VM template list. + :type value: list[~azure.mgmt.vmwarecloudsimple.models.VirtualMachineTemplate] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[VirtualMachineTemplate]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineTemplateListResponse, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) + + +class VirtualNetwork(msrest.serialization.Model): + """Virtual network model. + + 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 assignable: can be used in vm creation/deletion. + :vartype assignable: bool + :param id: Required. virtual network id (privateCloudId:vsphereId). + :type id: str + :ivar location: Azure region. + :vartype location: str + :ivar name: {VirtualNetworkName}. + :vartype name: str + :ivar type: {resourceProviderNamespace}/{resourceType}. + :vartype type: str + :ivar private_cloud_id: The Private Cloud id. + :vartype private_cloud_id: str + """ + + _validation = { + 'assignable': {'readonly': True}, + 'id': {'required': True}, + 'location': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'private_cloud_id': {'readonly': True}, + } + + _attribute_map = { + 'assignable': {'key': 'assignable', 'type': 'bool'}, + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_cloud_id': {'key': 'properties.privateCloudId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualNetwork, self).__init__(**kwargs) + self.assignable = None + self.id = kwargs['id'] + self.location = None + self.name = None + self.type = None + self.private_cloud_id = None + + +class VirtualNetworkListResponse(msrest.serialization.Model): + """List of virtual networks. + + :param next_link: Link for next list of VirtualNetwork. + :type next_link: str + :param value: Results of the VirtualNetwork list. + :type value: list[~azure.mgmt.vmwarecloudsimple.models.VirtualNetwork] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[VirtualNetwork]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualNetworkListResponse, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) + + +class VirtualNic(msrest.serialization.Model): + """Virtual NIC model. + + 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 customization: guest OS customization for nic. + :type customization: ~azure.mgmt.vmwarecloudsimple.models.GuestOSNICCustomization + :param ip_addresses: NIC ip address. + :type ip_addresses: list[str] + :param mac_address: NIC MAC address. + :type mac_address: str + :param network: Required. Virtual Network. + :type network: ~azure.mgmt.vmwarecloudsimple.models.VirtualNetwork + :param nic_type: Required. NIC type. Possible values include: "E1000", "E1000E", "PCNET32", + "VMXNET", "VMXNET2", "VMXNET3". + :type nic_type: str or ~azure.mgmt.vmwarecloudsimple.models.NICType + :param power_on_boot: Is NIC powered on/off on boot. + :type power_on_boot: bool + :param virtual_nic_id: NIC id. + :type virtual_nic_id: str + :ivar virtual_nic_name: NIC name. + :vartype virtual_nic_name: str + """ + + _validation = { + 'network': {'required': True}, + 'nic_type': {'required': True}, + 'virtual_nic_name': {'readonly': True}, + } + + _attribute_map = { + 'customization': {'key': 'customization', 'type': 'GuestOSNICCustomization'}, + 'ip_addresses': {'key': 'ipAddresses', 'type': '[str]'}, + 'mac_address': {'key': 'macAddress', 'type': 'str'}, + 'network': {'key': 'network', 'type': 'VirtualNetwork'}, + 'nic_type': {'key': 'nicType', 'type': 'str'}, + 'power_on_boot': {'key': 'powerOnBoot', 'type': 'bool'}, + 'virtual_nic_id': {'key': 'virtualNicId', 'type': 'str'}, + 'virtual_nic_name': {'key': 'virtualNicName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualNic, self).__init__(**kwargs) + self.customization = kwargs.get('customization', None) + self.ip_addresses = kwargs.get('ip_addresses', None) + self.mac_address = kwargs.get('mac_address', None) + self.network = kwargs['network'] + self.nic_type = kwargs['nic_type'] + self.power_on_boot = kwargs.get('power_on_boot', None) + self.virtual_nic_id = kwargs.get('virtual_nic_id', None) + self.virtual_nic_name = None diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/models/_models_py3.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/models/_models_py3.py new file mode 100644 index 000000000000..f2068b0fcba0 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/models/_models_py3.py @@ -0,0 +1,2095 @@ +# 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 datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._vmware_cloud_simple_enums import * + + +class AvailableOperation(msrest.serialization.Model): + """Resource provider available operation model. + + :param display: The list of operations. + :type display: ~azure.mgmt.vmwarecloudsimple.models.AvailableOperationDisplay + :param is_data_action: Indicating whether the operation is a data action or not. + :type is_data_action: bool + :param name: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}. + :type name: str + :param origin: The origin of operation. Possible values include: "user", "system", + "user,system". + :type origin: str or ~azure.mgmt.vmwarecloudsimple.models.OperationOrigin + :param service_specification: The list of specification's service metrics. + :type service_specification: + ~azure.mgmt.vmwarecloudsimple.models.AvailableOperationDisplayPropertyServiceSpecificationMetricsList + """ + + _attribute_map = { + 'display': {'key': 'display', 'type': 'AvailableOperationDisplay'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'AvailableOperationDisplayPropertyServiceSpecificationMetricsList'}, + } + + def __init__( + self, + *, + display: Optional["AvailableOperationDisplay"] = None, + is_data_action: Optional[bool] = False, + name: Optional[str] = None, + origin: Optional[Union[str, "OperationOrigin"]] = None, + service_specification: Optional["AvailableOperationDisplayPropertyServiceSpecificationMetricsList"] = None, + **kwargs + ): + super(AvailableOperation, self).__init__(**kwargs) + self.display = display + self.is_data_action = is_data_action + self.name = name + self.origin = origin + self.service_specification = service_specification + + +class AvailableOperationDisplay(msrest.serialization.Model): + """Resource provider available operation display model. + + :param description: Description of the operation for display purposes. + :type description: str + :param operation: Name of the operation for display purposes. + :type operation: str + :param provider: Name of the provider for display purposes. + :type provider: str + :param resource: Name of the resource type for display purposes. + :type resource: str + """ + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + operation: Optional[str] = None, + provider: Optional[str] = None, + resource: Optional[str] = None, + **kwargs + ): + super(AvailableOperationDisplay, self).__init__(**kwargs) + self.description = description + self.operation = operation + self.provider = provider + self.resource = resource + + +class AvailableOperationDisplayPropertyServiceSpecificationMetricsItem(msrest.serialization.Model): + """Available operation display property service specification metrics item. + + All required parameters must be populated in order to send to Azure. + + :param aggregation_type: Required. Metric's aggregation type for e.g. (Average, Total). + Possible values include: "Average", "Total". + :type aggregation_type: str or ~azure.mgmt.vmwarecloudsimple.models.AggregationType + :param display_description: Required. Metric's description. + :type display_description: str + :param display_name: Required. Human readable metric's name. + :type display_name: str + :param name: Required. Metric's name/id. + :type name: str + :param unit: Required. Metric's unit. + :type unit: str + """ + + _validation = { + 'aggregation_type': {'required': True}, + 'display_description': {'required': True}, + 'display_name': {'required': True}, + 'name': {'required': True}, + 'unit': {'required': True}, + } + + _attribute_map = { + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + } + + def __init__( + self, + *, + aggregation_type: Union[str, "AggregationType"], + display_description: str, + display_name: str, + name: str, + unit: str, + **kwargs + ): + super(AvailableOperationDisplayPropertyServiceSpecificationMetricsItem, self).__init__(**kwargs) + self.aggregation_type = aggregation_type + self.display_description = display_description + self.display_name = display_name + self.name = name + self.unit = unit + + +class AvailableOperationDisplayPropertyServiceSpecificationMetricsList(msrest.serialization.Model): + """List of available operation display property service specification metrics. + + :param metric_specifications: Metric specifications of operation. + :type metric_specifications: + list[~azure.mgmt.vmwarecloudsimple.models.AvailableOperationDisplayPropertyServiceSpecificationMetricsItem] + """ + + _attribute_map = { + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[AvailableOperationDisplayPropertyServiceSpecificationMetricsItem]'}, + } + + def __init__( + self, + *, + metric_specifications: Optional[List["AvailableOperationDisplayPropertyServiceSpecificationMetricsItem"]] = None, + **kwargs + ): + super(AvailableOperationDisplayPropertyServiceSpecificationMetricsList, self).__init__(**kwargs) + self.metric_specifications = metric_specifications + + +class AvailableOperationsListResponse(msrest.serialization.Model): + """List of available operations. + + :param next_link: Link for next list of available operations. + :type next_link: str + :param value: Returns a list of available operations. + :type value: list[~azure.mgmt.vmwarecloudsimple.models.AvailableOperation] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[AvailableOperation]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["AvailableOperation"]] = None, + **kwargs + ): + super(AvailableOperationsListResponse, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class CSRPError(msrest.serialization.Model): + """General error model. + + :param error: Error's body. + :type error: ~azure.mgmt.vmwarecloudsimple.models.CSRPErrorBody + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'CSRPErrorBody'}, + } + + def __init__( + self, + *, + error: Optional["CSRPErrorBody"] = None, + **kwargs + ): + super(CSRPError, self).__init__(**kwargs) + self.error = error + + +class CSRPErrorBody(msrest.serialization.Model): + """Error properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error's code. + :vartype code: str + :ivar details: Error's details. + :vartype details: list[~azure.mgmt.vmwarecloudsimple.models.CSRPErrorBody] + :ivar message: Error's message. + :vartype message: str + :param target: Error's target. + :type target: str + """ + + _validation = { + 'code': {'readonly': True}, + 'details': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CSRPErrorBody]'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__( + self, + *, + target: Optional[str] = None, + **kwargs + ): + super(CSRPErrorBody, self).__init__(**kwargs) + self.code = None + self.details = None + self.message = None + self.target = target + + +class CustomizationHostName(msrest.serialization.Model): + """Host name model. + + :param name: Hostname. + :type name: str + :param type: Type of host name. Possible values include: "USER_DEFINED", "PREFIX_BASED", + "FIXED", "VIRTUAL_MACHINE_NAME", "CUSTOM_NAME". + :type type: str or ~azure.mgmt.vmwarecloudsimple.models.CustomizationHostNameType + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[Union[str, "CustomizationHostNameType"]] = None, + **kwargs + ): + super(CustomizationHostName, self).__init__(**kwargs) + self.name = name + self.type = type + + +class CustomizationIdentity(msrest.serialization.Model): + """CustomizationIdentity. + + :param data: Windows Text Identity. Prepared data. + :type data: str + :param host_name: Virtual machine host name settings. + :type host_name: ~azure.mgmt.vmwarecloudsimple.models.CustomizationHostName + :param type: Identity type. Possible values include: "WINDOWS_TEXT", "WINDOWS", "LINUX". + :type type: str or ~azure.mgmt.vmwarecloudsimple.models.CustomizationIdentityType + :param user_data: Windows Identity. User data customization. + :type user_data: ~azure.mgmt.vmwarecloudsimple.models.CustomizationIdentityUserData + """ + + _attribute_map = { + 'data': {'key': 'data', 'type': 'str'}, + 'host_name': {'key': 'hostName', 'type': 'CustomizationHostName'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_data': {'key': 'userData', 'type': 'CustomizationIdentityUserData'}, + } + + def __init__( + self, + *, + data: Optional[str] = None, + host_name: Optional["CustomizationHostName"] = None, + type: Optional[Union[str, "CustomizationIdentityType"]] = None, + user_data: Optional["CustomizationIdentityUserData"] = None, + **kwargs + ): + super(CustomizationIdentity, self).__init__(**kwargs) + self.data = data + self.host_name = host_name + self.type = type + self.user_data = user_data + + +class CustomizationIdentityUserData(msrest.serialization.Model): + """Windows Identity. User data customization. + + :param is_password_predefined: Is password predefined in customization policy. + :type is_password_predefined: bool + """ + + _attribute_map = { + 'is_password_predefined': {'key': 'isPasswordPredefined', 'type': 'bool'}, + } + + def __init__( + self, + *, + is_password_predefined: Optional[bool] = False, + **kwargs + ): + super(CustomizationIdentityUserData, self).__init__(**kwargs) + self.is_password_predefined = is_password_predefined + + +class CustomizationIPAddress(msrest.serialization.Model): + """CustomizationIPAddress. + + :param argument: Argument when Custom ip type is selected. + :type argument: str + :param ip_address: Defined Ip Address when Fixed ip type is selected. + :type ip_address: str + :param type: Customization Specification ip type. Possible values include: "CUSTOM", "DHCP_IP", + "FIXED_IP", "USER_DEFINED". + :type type: str or ~azure.mgmt.vmwarecloudsimple.models.CustomizationIPAddressType + """ + + _attribute_map = { + 'argument': {'key': 'argument', 'type': 'str'}, + 'ip_address': {'key': 'ipAddress', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + argument: Optional[str] = None, + ip_address: Optional[str] = None, + type: Optional[Union[str, "CustomizationIPAddressType"]] = None, + **kwargs + ): + super(CustomizationIPAddress, self).__init__(**kwargs) + self.argument = argument + self.ip_address = ip_address + self.type = type + + +class CustomizationIPSettings(msrest.serialization.Model): + """CustomizationIPSettings. + + :param gateway: The list of gateways. + :type gateway: list[str] + :param ip: Ip address customization settings. + :type ip: ~azure.mgmt.vmwarecloudsimple.models.CustomizationIPAddress + :param subnet_mask: Adapter subnet mask. + :type subnet_mask: str + """ + + _attribute_map = { + 'gateway': {'key': 'gateway', 'type': '[str]'}, + 'ip': {'key': 'ip', 'type': 'CustomizationIPAddress'}, + 'subnet_mask': {'key': 'subnetMask', 'type': 'str'}, + } + + def __init__( + self, + *, + gateway: Optional[List[str]] = None, + ip: Optional["CustomizationIPAddress"] = None, + subnet_mask: Optional[str] = None, + **kwargs + ): + super(CustomizationIPSettings, self).__init__(**kwargs) + self.gateway = gateway + self.ip = ip + self.subnet_mask = subnet_mask + + +class CustomizationNicSetting(msrest.serialization.Model): + """CustomizationNicSetting. + + :param adapter: The list of adapters' settings. + :type adapter: ~azure.mgmt.vmwarecloudsimple.models.CustomizationIPSettings + :param mac_address: NIC mac address. + :type mac_address: str + """ + + _attribute_map = { + 'adapter': {'key': 'adapter', 'type': 'CustomizationIPSettings'}, + 'mac_address': {'key': 'macAddress', 'type': 'str'}, + } + + def __init__( + self, + *, + adapter: Optional["CustomizationIPSettings"] = None, + mac_address: Optional[str] = None, + **kwargs + ): + super(CustomizationNicSetting, self).__init__(**kwargs) + self.adapter = adapter + self.mac_address = mac_address + + +class CustomizationPoliciesListResponse(msrest.serialization.Model): + """List of customization polices response model. + + :param next_link: Link for next list of the Customization policy. + :type next_link: str + :param value: List of the customization policies. + :type value: list[~azure.mgmt.vmwarecloudsimple.models.CustomizationPolicy] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[CustomizationPolicy]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["CustomizationPolicy"]] = None, + **kwargs + ): + super(CustomizationPoliciesListResponse, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class CustomizationPolicy(msrest.serialization.Model): + """The virtual machine customization policy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: Customization policy azure id. + :type id: str + :param location: Azure region. + :type location: str + :ivar name: Customization policy name. + :vartype name: str + :ivar type: + :vartype type: str + :param description: Policy description. + :type description: str + :param private_cloud_id: The Private cloud id. + :type private_cloud_id: str + :param specification: Detailed customization policy specification. + :type specification: ~azure.mgmt.vmwarecloudsimple.models.CustomizationSpecification + :param type_properties_type: The type of customization (Linux or Windows). Possible values + include: "LINUX", "WINDOWS". + :type type_properties_type: str or + ~azure.mgmt.vmwarecloudsimple.models.CustomizationPolicyPropertiesType + :param version: Policy version. + :type version: str + """ + + _validation = { + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'private_cloud_id': {'key': 'properties.privateCloudId', 'type': 'str'}, + 'specification': {'key': 'properties.specification', 'type': 'CustomizationSpecification'}, + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + location: Optional[str] = None, + description: Optional[str] = None, + private_cloud_id: Optional[str] = None, + specification: Optional["CustomizationSpecification"] = None, + type_properties_type: Optional[Union[str, "CustomizationPolicyPropertiesType"]] = None, + version: Optional[str] = None, + **kwargs + ): + super(CustomizationPolicy, self).__init__(**kwargs) + self.id = id + self.location = location + self.name = None + self.type = None + self.description = description + self.private_cloud_id = private_cloud_id + self.specification = specification + self.type_properties_type = type_properties_type + self.version = version + + +class CustomizationSpecification(msrest.serialization.Model): + """The specification for Customization Policy. + + :param identity: Customization Identity. It contains data about user and hostname. + :type identity: ~azure.mgmt.vmwarecloudsimple.models.CustomizationIdentity + :param nic_settings: Network interface settings. + :type nic_settings: list[~azure.mgmt.vmwarecloudsimple.models.CustomizationNicSetting] + """ + + _attribute_map = { + 'identity': {'key': 'identity', 'type': 'CustomizationIdentity'}, + 'nic_settings': {'key': 'nicSettings', 'type': '[CustomizationNicSetting]'}, + } + + def __init__( + self, + *, + identity: Optional["CustomizationIdentity"] = None, + nic_settings: Optional[List["CustomizationNicSetting"]] = None, + **kwargs + ): + super(CustomizationSpecification, self).__init__(**kwargs) + self.identity = identity + self.nic_settings = nic_settings + + +class DedicatedCloudNode(msrest.serialization.Model): + """Dedicated cloud node model. + + 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: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/dedicatedCloudNodes/{dedicatedCloudNodeName}. + :vartype id: str + :param location: Required. Azure region. + :type location: str + :ivar name: {dedicatedCloudNodeName}. + :vartype name: str + :param sku: Dedicated Cloud Nodes SKU. + :type sku: ~azure.mgmt.vmwarecloudsimple.models.Sku + :param tags: A set of tags. Dedicated Cloud Nodes tags. + :type tags: dict[str, str] + :ivar type: {resourceProviderNamespace}/{resourceType}. + :vartype type: str + :param availability_zone_id: Availability Zone id, e.g. "az1". + :type availability_zone_id: str + :ivar availability_zone_name: Availability Zone name, e.g. "Availability Zone 1". + :vartype availability_zone_name: str + :ivar cloud_rack_name: VMWare Cloud Rack Name. + :vartype cloud_rack_name: str + :ivar created: date time the resource was created. + :vartype created: any + :param nodes_count: count of nodes to create. + :type nodes_count: int + :param placement_group_id: Placement Group id, e.g. "n1". + :type placement_group_id: str + :ivar placement_group_name: Placement Name, e.g. "Placement Group 1". + :vartype placement_group_name: str + :ivar private_cloud_id: Private Cloud Id. + :vartype private_cloud_id: str + :ivar private_cloud_name: Resource Pool Name. + :vartype private_cloud_name: str + :ivar provisioning_state: The provisioning status of the resource. + :vartype provisioning_state: str + :param purchase_id: purchase id. + :type purchase_id: str + :ivar status: Node status, indicates is private cloud set up on this node or not. Possible + values include: "unused", "used". + :vartype status: str or ~azure.mgmt.vmwarecloudsimple.models.NodeStatus + :ivar vmware_cluster_name: VMWare Cluster Name. + :vartype vmware_cluster_name: str + :param id_properties_sku_description_id: SKU's id. + :type id_properties_sku_description_id: str + :param name_properties_sku_description_name: SKU's name. + :type name_properties_sku_description_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'location': {'required': True}, + 'name': {'readonly': True, 'pattern': r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'}, + 'type': {'readonly': True}, + 'availability_zone_name': {'readonly': True}, + 'cloud_rack_name': {'readonly': True}, + 'created': {'readonly': True}, + 'placement_group_name': {'readonly': True}, + 'private_cloud_id': {'readonly': True}, + 'private_cloud_name': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'vmware_cluster_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'type': {'key': 'type', 'type': 'str'}, + 'availability_zone_id': {'key': 'properties.availabilityZoneId', 'type': 'str'}, + 'availability_zone_name': {'key': 'properties.availabilityZoneName', 'type': 'str'}, + 'cloud_rack_name': {'key': 'properties.cloudRackName', 'type': 'str'}, + 'created': {'key': 'properties.created', 'type': 'object'}, + 'nodes_count': {'key': 'properties.nodesCount', 'type': 'int'}, + 'placement_group_id': {'key': 'properties.placementGroupId', 'type': 'str'}, + 'placement_group_name': {'key': 'properties.placementGroupName', 'type': 'str'}, + 'private_cloud_id': {'key': 'properties.privateCloudId', 'type': 'str'}, + 'private_cloud_name': {'key': 'properties.privateCloudName', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'purchase_id': {'key': 'properties.purchaseId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'vmware_cluster_name': {'key': 'properties.vmwareClusterName', 'type': 'str'}, + 'id_properties_sku_description_id': {'key': 'properties.skuDescription.id', 'type': 'str'}, + 'name_properties_sku_description_name': {'key': 'properties.skuDescription.name', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + sku: Optional["Sku"] = None, + tags: Optional[Dict[str, str]] = None, + availability_zone_id: Optional[str] = None, + nodes_count: Optional[int] = None, + placement_group_id: Optional[str] = None, + purchase_id: Optional[str] = None, + id_properties_sku_description_id: Optional[str] = None, + name_properties_sku_description_name: Optional[str] = None, + **kwargs + ): + super(DedicatedCloudNode, self).__init__(**kwargs) + self.id = None + self.location = location + self.name = None + self.sku = sku + self.tags = tags + self.type = None + self.availability_zone_id = availability_zone_id + self.availability_zone_name = None + self.cloud_rack_name = None + self.created = None + self.nodes_count = nodes_count + self.placement_group_id = placement_group_id + self.placement_group_name = None + self.private_cloud_id = None + self.private_cloud_name = None + self.provisioning_state = None + self.purchase_id = purchase_id + self.status = None + self.vmware_cluster_name = None + self.id_properties_sku_description_id = id_properties_sku_description_id + self.name_properties_sku_description_name = name_properties_sku_description_name + + +class DedicatedCloudNodeListResponse(msrest.serialization.Model): + """List of dedicated nodes response model. + + :param next_link: Link for next list of DedicatedCloudNode. + :type next_link: str + :param value: Results of the DedicatedCloudNode list. + :type value: list[~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudNode] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[DedicatedCloudNode]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["DedicatedCloudNode"]] = None, + **kwargs + ): + super(DedicatedCloudNodeListResponse, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class DedicatedCloudService(msrest.serialization.Model): + """Dedicated cloud service model. + + 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: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/dedicatedCloudServices/{dedicatedCloudServiceName}. + :vartype id: str + :param location: Required. Azure region. + :type location: str + :ivar name: {dedicatedCloudServiceName}. + :vartype name: str + :param tags: A set of tags. The list of tags. + :type tags: dict[str, str] + :ivar type: {resourceProviderNamespace}/{resourceType}. + :vartype type: str + :param gateway_subnet: gateway Subnet for the account. It will collect the subnet address and + always treat it as /28. + :type gateway_subnet: str + :ivar is_account_onboarded: indicates whether account onboarded or not in a given region. + Possible values include: "notOnBoarded", "onBoarded", "onBoardingFailed", "onBoarding". + :vartype is_account_onboarded: str or ~azure.mgmt.vmwarecloudsimple.models.OnboardingStatus + :ivar nodes: total nodes purchased. + :vartype nodes: int + :ivar service_url: link to a service management web portal. + :vartype service_url: str + """ + + _validation = { + 'id': {'readonly': True}, + 'location': {'required': True}, + 'name': {'readonly': True, 'pattern': r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'}, + 'type': {'readonly': True}, + 'is_account_onboarded': {'readonly': True}, + 'nodes': {'readonly': True}, + 'service_url': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'type': {'key': 'type', 'type': 'str'}, + 'gateway_subnet': {'key': 'properties.gatewaySubnet', 'type': 'str'}, + 'is_account_onboarded': {'key': 'properties.isAccountOnboarded', 'type': 'str'}, + 'nodes': {'key': 'properties.nodes', 'type': 'int'}, + 'service_url': {'key': 'properties.serviceURL', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + gateway_subnet: Optional[str] = None, + **kwargs + ): + super(DedicatedCloudService, self).__init__(**kwargs) + self.id = None + self.location = location + self.name = None + self.tags = tags + self.type = None + self.gateway_subnet = gateway_subnet + self.is_account_onboarded = None + self.nodes = None + self.service_url = None + + +class DedicatedCloudServiceListResponse(msrest.serialization.Model): + """List of dedicated cloud services. + + :param next_link: Link for next list of DedicatedCloudNode. + :type next_link: str + :param value: Results of the DedicatedCloudService list. + :type value: list[~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudService] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[DedicatedCloudService]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["DedicatedCloudService"]] = None, + **kwargs + ): + super(DedicatedCloudServiceListResponse, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class GuestOSCustomization(msrest.serialization.Model): + """Guest OS Customization properties. + + :param dns_servers: List of dns servers to use. + :type dns_servers: list[str] + :param host_name: Virtual Machine hostname. + :type host_name: str + :param password: Password for login. + :type password: str + :param policy_id: id of customization policy. + :type policy_id: str + :param username: Username for login. + :type username: str + """ + + _attribute_map = { + 'dns_servers': {'key': 'dnsServers', 'type': '[str]'}, + 'host_name': {'key': 'hostName', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + 'policy_id': {'key': 'policyId', 'type': 'str'}, + 'username': {'key': 'username', 'type': 'str'}, + } + + def __init__( + self, + *, + dns_servers: Optional[List[str]] = None, + host_name: Optional[str] = None, + password: Optional[str] = None, + policy_id: Optional[str] = None, + username: Optional[str] = None, + **kwargs + ): + super(GuestOSCustomization, self).__init__(**kwargs) + self.dns_servers = dns_servers + self.host_name = host_name + self.password = password + self.policy_id = policy_id + self.username = username + + +class GuestOSNICCustomization(msrest.serialization.Model): + """Guest OS nic customization. + + :param allocation: IP address allocation method. Possible values include: "static", "dynamic". + :type allocation: str or ~azure.mgmt.vmwarecloudsimple.models.GuestOSNICCustomizationAllocation + :param dns_servers: List of dns servers to use. + :type dns_servers: list[str] + :param gateway: Gateway addresses assigned to nic. + :type gateway: list[str] + :param ip_address: Static ip address for nic. + :type ip_address: str + :param mask: Network mask for nic. + :type mask: str + :param primary_wins_server: primary WINS server for Windows. + :type primary_wins_server: str + :param secondary_wins_server: secondary WINS server for Windows. + :type secondary_wins_server: str + """ + + _validation = { + 'ip_address': {'pattern': r'^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])[.]){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'}, + 'mask': {'pattern': r'^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])[.]){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'}, + 'primary_wins_server': {'pattern': r'^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])[.]){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'}, + 'secondary_wins_server': {'pattern': r'^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])[.]){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'}, + } + + _attribute_map = { + 'allocation': {'key': 'allocation', 'type': 'str'}, + 'dns_servers': {'key': 'dnsServers', 'type': '[str]'}, + 'gateway': {'key': 'gateway', 'type': '[str]'}, + 'ip_address': {'key': 'ipAddress', 'type': 'str'}, + 'mask': {'key': 'mask', 'type': 'str'}, + 'primary_wins_server': {'key': 'primaryWinsServer', 'type': 'str'}, + 'secondary_wins_server': {'key': 'secondaryWinsServer', 'type': 'str'}, + } + + def __init__( + self, + *, + allocation: Optional[Union[str, "GuestOSNICCustomizationAllocation"]] = None, + dns_servers: Optional[List[str]] = None, + gateway: Optional[List[str]] = None, + ip_address: Optional[str] = None, + mask: Optional[str] = None, + primary_wins_server: Optional[str] = None, + secondary_wins_server: Optional[str] = None, + **kwargs + ): + super(GuestOSNICCustomization, self).__init__(**kwargs) + self.allocation = allocation + self.dns_servers = dns_servers + self.gateway = gateway + self.ip_address = ip_address + self.mask = mask + self.primary_wins_server = primary_wins_server + self.secondary_wins_server = secondary_wins_server + + +class OperationError(msrest.serialization.Model): + """Operation error model. + + :param code: Error's code. + :type code: str + :param message: Error's message. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + super(OperationError, self).__init__(**kwargs) + self.code = code + self.message = message + + +class OperationResource(msrest.serialization.Model): + """Operation status response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar end_time: End time of the operation. + :vartype end_time: ~datetime.datetime + :param error: Error Message if operation failed. + :type error: ~azure.mgmt.vmwarecloudsimple.models.OperationError + :ivar id: Operation Id. + :vartype id: str + :ivar name: Operation ID. + :vartype name: str + :ivar start_time: Start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar status: Operation status. + :vartype status: str + """ + + _validation = { + 'end_time': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'start_time': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'error': {'key': 'error', 'type': 'OperationError'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + error: Optional["OperationError"] = None, + **kwargs + ): + super(OperationResource, self).__init__(**kwargs) + self.end_time = None + self.error = error + self.id = None + self.name = None + self.start_time = None + self.status = None + + +class PatchPayload(msrest.serialization.Model): + """General patch payload modal. + + :param tags: A set of tags. The tags key:value pairs. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(PatchPayload, self).__init__(**kwargs) + self.tags = tags + + +class PrivateCloud(msrest.serialization.Model): + """Private cloud model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: Azure Id, e.g. + "/subscriptions/4da99247-a172-4ed6-8ae9-ebed2d12f839/providers/Microsoft.VMwareCloudSimple/privateClouds/cloud123". + :type id: str + :param location: Location where private cloud created, e.g "westus". + :type location: str + :param name: Private cloud name. + :type name: str + :ivar type: Azure Resource type. Default value: "Microsoft.VMwareCloudSimple/privateClouds". + :vartype type: str + :param availability_zone_id: Availability Zone id, e.g. "az1". + :type availability_zone_id: str + :param availability_zone_name: Availability Zone name, e.g. "Availability Zone 1". + :type availability_zone_name: str + :param clusters_number: Number of clusters. + :type clusters_number: int + :param created_by: User's emails who created cloud. + :type created_by: str + :param created_on: When private cloud was created. + :type created_on: ~datetime.datetime + :param dns_servers: Array of DNS servers. + :type dns_servers: list[str] + :param expires: Expiration date of PC. + :type expires: str + :param nsx_type: Nsx Type, e.g. "Advanced". + :type nsx_type: str + :param placement_group_id: Placement Group id, e.g. "n1". + :type placement_group_id: str + :param placement_group_name: Placement Group name. + :type placement_group_name: str + :param private_cloud_id: Id of a private cloud. + :type private_cloud_id: str + :param resource_pools: The list of Resource Pools. + :type resource_pools: list[~azure.mgmt.vmwarecloudsimple.models.ResourcePool] + :param state: Private Cloud state, e.g. "operational". + :type state: str + :param total_cpu_cores: Number of cores. + :type total_cpu_cores: int + :param total_nodes: Number of nodes. + :type total_nodes: int + :param total_ram: Memory size. + :type total_ram: int + :param total_storage: Disk space in TB. + :type total_storage: float + :param type_properties_type: Virtualization type e.g. "vSphere". + :type type_properties_type: str + :param v_sphere_version: e.g. "6.5u2". + :type v_sphere_version: str + :param vcenter_fqdn: FQDN for vcenter access. + :type vcenter_fqdn: str + :param vcenter_refid: Vcenter ip address. + :type vcenter_refid: str + :param virtual_machine_templates: The list of Virtual Machine Templates. + :type virtual_machine_templates: + list[~azure.mgmt.vmwarecloudsimple.models.VirtualMachineTemplate] + :param virtual_networks: The list of Virtual Networks. + :type virtual_networks: list[~azure.mgmt.vmwarecloudsimple.models.VirtualNetwork] + :param vr_ops_enabled: Is Vrops enabled/disabled. + :type vr_ops_enabled: bool + """ + + _validation = { + 'type': {'constant': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'availability_zone_id': {'key': 'properties.availabilityZoneId', 'type': 'str'}, + 'availability_zone_name': {'key': 'properties.availabilityZoneName', 'type': 'str'}, + 'clusters_number': {'key': 'properties.clustersNumber', 'type': 'int'}, + 'created_by': {'key': 'properties.createdBy', 'type': 'str'}, + 'created_on': {'key': 'properties.createdOn', 'type': 'iso-8601'}, + 'dns_servers': {'key': 'properties.dnsServers', 'type': '[str]'}, + 'expires': {'key': 'properties.expires', 'type': 'str'}, + 'nsx_type': {'key': 'properties.nsxType', 'type': 'str'}, + 'placement_group_id': {'key': 'properties.placementGroupId', 'type': 'str'}, + 'placement_group_name': {'key': 'properties.placementGroupName', 'type': 'str'}, + 'private_cloud_id': {'key': 'properties.privateCloudId', 'type': 'str'}, + 'resource_pools': {'key': 'properties.resourcePools', 'type': '[ResourcePool]'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'total_cpu_cores': {'key': 'properties.totalCpuCores', 'type': 'int'}, + 'total_nodes': {'key': 'properties.totalNodes', 'type': 'int'}, + 'total_ram': {'key': 'properties.totalRam', 'type': 'int'}, + 'total_storage': {'key': 'properties.totalStorage', 'type': 'float'}, + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, + 'v_sphere_version': {'key': 'properties.vSphereVersion', 'type': 'str'}, + 'vcenter_fqdn': {'key': 'properties.vcenterFqdn', 'type': 'str'}, + 'vcenter_refid': {'key': 'properties.vcenterRefid', 'type': 'str'}, + 'virtual_machine_templates': {'key': 'properties.virtualMachineTemplates', 'type': '[VirtualMachineTemplate]'}, + 'virtual_networks': {'key': 'properties.virtualNetworks', 'type': '[VirtualNetwork]'}, + 'vr_ops_enabled': {'key': 'properties.vrOpsEnabled', 'type': 'bool'}, + } + + type = "Microsoft.VMwareCloudSimple/privateClouds" + + def __init__( + self, + *, + id: Optional[str] = None, + location: Optional[str] = None, + name: Optional[str] = None, + availability_zone_id: Optional[str] = None, + availability_zone_name: Optional[str] = None, + clusters_number: Optional[int] = None, + created_by: Optional[str] = None, + created_on: Optional[datetime.datetime] = None, + dns_servers: Optional[List[str]] = None, + expires: Optional[str] = None, + nsx_type: Optional[str] = None, + placement_group_id: Optional[str] = None, + placement_group_name: Optional[str] = None, + private_cloud_id: Optional[str] = None, + resource_pools: Optional[List["ResourcePool"]] = None, + state: Optional[str] = None, + total_cpu_cores: Optional[int] = None, + total_nodes: Optional[int] = None, + total_ram: Optional[int] = None, + total_storage: Optional[float] = None, + type_properties_type: Optional[str] = None, + v_sphere_version: Optional[str] = None, + vcenter_fqdn: Optional[str] = None, + vcenter_refid: Optional[str] = None, + virtual_machine_templates: Optional[List["VirtualMachineTemplate"]] = None, + virtual_networks: Optional[List["VirtualNetwork"]] = None, + vr_ops_enabled: Optional[bool] = None, + **kwargs + ): + super(PrivateCloud, self).__init__(**kwargs) + self.id = id + self.location = location + self.name = name + self.availability_zone_id = availability_zone_id + self.availability_zone_name = availability_zone_name + self.clusters_number = clusters_number + self.created_by = created_by + self.created_on = created_on + self.dns_servers = dns_servers + self.expires = expires + self.nsx_type = nsx_type + self.placement_group_id = placement_group_id + self.placement_group_name = placement_group_name + self.private_cloud_id = private_cloud_id + self.resource_pools = resource_pools + self.state = state + self.total_cpu_cores = total_cpu_cores + self.total_nodes = total_nodes + self.total_ram = total_ram + self.total_storage = total_storage + self.type_properties_type = type_properties_type + self.v_sphere_version = v_sphere_version + self.vcenter_fqdn = vcenter_fqdn + self.vcenter_refid = vcenter_refid + self.virtual_machine_templates = virtual_machine_templates + self.virtual_networks = virtual_networks + self.vr_ops_enabled = vr_ops_enabled + + +class PrivateCloudList(msrest.serialization.Model): + """List of private clouds. + + :param next_link: Link for next list of Private Clouds. + :type next_link: str + :param value: the list of private clouds. + :type value: list[~azure.mgmt.vmwarecloudsimple.models.PrivateCloud] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[PrivateCloud]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["PrivateCloud"]] = None, + **kwargs + ): + super(PrivateCloudList, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class ResourcePool(msrest.serialization.Model): + """Resource pool model. + + 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 id: Required. resource pool id (privateCloudId:vsphereId). + :type id: str + :ivar location: Azure region. + :vartype location: str + :ivar name: {ResourcePoolName}. + :vartype name: str + :ivar private_cloud_id: The Private Cloud Id. + :vartype private_cloud_id: str + :ivar type: {resourceProviderNamespace}/{resourceType}. + :vartype type: str + :ivar full_name: Hierarchical resource pool name. + :vartype full_name: str + """ + + _validation = { + 'id': {'required': True}, + 'location': {'readonly': True}, + 'name': {'readonly': True}, + 'private_cloud_id': {'readonly': True}, + 'type': {'readonly': True}, + 'full_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'private_cloud_id': {'key': 'privateCloudId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'full_name': {'key': 'properties.fullName', 'type': 'str'}, + } + + def __init__( + self, + *, + id: str, + **kwargs + ): + super(ResourcePool, self).__init__(**kwargs) + self.id = id + self.location = None + self.name = None + self.private_cloud_id = None + self.type = None + self.full_name = None + + +class ResourcePoolsListResponse(msrest.serialization.Model): + """List of resource pools response model. + + :param next_link: Link for next list of ResourcePoolsList. + :type next_link: str + :param value: Results of the Resource pools list. + :type value: list[~azure.mgmt.vmwarecloudsimple.models.ResourcePool] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[ResourcePool]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["ResourcePool"]] = None, + **kwargs + ): + super(ResourcePoolsListResponse, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class Sku(msrest.serialization.Model): + """The purchase SKU for CloudSimple paid resources. + + All required parameters must be populated in order to send to Azure. + + :param capacity: The capacity of the SKU. + :type capacity: str + :param description: dedicatedCloudNode example: 8 x Ten-Core Intel® Xeon® Processor E5-2640 v4 + 2.40GHz 25MB Cache (90W); 12 x 64GB PC4-19200 2400MHz DDR4 ECC Registered DIMM, ... + :type description: str + :param family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :type family: str + :param name: Required. The name of the SKU for VMWare CloudSimple Node. + :type name: str + :param tier: The tier of the SKU. + :type tier: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'capacity': {'key': 'capacity', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + capacity: Optional[str] = None, + description: Optional[str] = None, + family: Optional[str] = None, + tier: Optional[str] = None, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.capacity = capacity + self.description = description + self.family = family + self.name = name + self.tier = tier + + +class SkuAvailability(msrest.serialization.Model): + """SKU availability model. + + All required parameters must be populated in order to send to Azure. + + :param dedicated_availability_zone_id: CloudSimple Availability Zone id. + :type dedicated_availability_zone_id: str + :param dedicated_availability_zone_name: CloudSimple Availability Zone Name. + :type dedicated_availability_zone_name: str + :param dedicated_placement_group_id: CloudSimple Placement Group Id. + :type dedicated_placement_group_id: str + :param dedicated_placement_group_name: CloudSimple Placement Group name. + :type dedicated_placement_group_name: str + :param limit: Required. indicates how many resources of a given SKU is available in a AZ->PG. + :type limit: int + :param resource_type: resource type e.g. DedicatedCloudNodes. + :type resource_type: str + :param sku_id: sku id. + :type sku_id: str + :param sku_name: sku name. + :type sku_name: str + """ + + _validation = { + 'limit': {'required': True}, + } + + _attribute_map = { + 'dedicated_availability_zone_id': {'key': 'dedicatedAvailabilityZoneId', 'type': 'str'}, + 'dedicated_availability_zone_name': {'key': 'dedicatedAvailabilityZoneName', 'type': 'str'}, + 'dedicated_placement_group_id': {'key': 'dedicatedPlacementGroupId', 'type': 'str'}, + 'dedicated_placement_group_name': {'key': 'dedicatedPlacementGroupName', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'sku_id': {'key': 'skuId', 'type': 'str'}, + 'sku_name': {'key': 'skuName', 'type': 'str'}, + } + + def __init__( + self, + *, + limit: int, + dedicated_availability_zone_id: Optional[str] = None, + dedicated_availability_zone_name: Optional[str] = None, + dedicated_placement_group_id: Optional[str] = None, + dedicated_placement_group_name: Optional[str] = None, + resource_type: Optional[str] = None, + sku_id: Optional[str] = None, + sku_name: Optional[str] = None, + **kwargs + ): + super(SkuAvailability, self).__init__(**kwargs) + self.dedicated_availability_zone_id = dedicated_availability_zone_id + self.dedicated_availability_zone_name = dedicated_availability_zone_name + self.dedicated_placement_group_id = dedicated_placement_group_id + self.dedicated_placement_group_name = dedicated_placement_group_name + self.limit = limit + self.resource_type = resource_type + self.sku_id = sku_id + self.sku_name = sku_name + + +class SkuAvailabilityListResponse(msrest.serialization.Model): + """List of SKU availabilities. + + :param next_link: Link for next list of DedicatedCloudNode. + :type next_link: str + :param value: Results of the DedicatedPlacementGroupSkuAvailability list. + :type value: list[~azure.mgmt.vmwarecloudsimple.models.SkuAvailability] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[SkuAvailability]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["SkuAvailability"]] = None, + **kwargs + ): + super(SkuAvailabilityListResponse, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class Usage(msrest.serialization.Model): + """Usage model. + + All required parameters must be populated in order to send to Azure. + + :param current_value: Required. The current usage value. + :type current_value: int + :param limit: Required. limit of a given sku in a region for a subscription. The maximum + permitted value for the usage quota. If there is no limit, this value will be -1. + :type limit: int + :param name: Usage name value and localized name. + :type name: ~azure.mgmt.vmwarecloudsimple.models.UsageName + :param unit: The usages' unit. Possible values include: "Count", "Bytes", "Seconds", "Percent", + "CountPerSecond", "BytesPerSecond". + :type unit: str or ~azure.mgmt.vmwarecloudsimple.models.UsageCount + """ + + _validation = { + 'current_value': {'required': True}, + 'limit': {'required': True}, + } + + _attribute_map = { + 'current_value': {'key': 'currentValue', 'type': 'int'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'UsageName'}, + 'unit': {'key': 'unit', 'type': 'str'}, + } + + def __init__( + self, + *, + current_value: int, + limit: int, + name: Optional["UsageName"] = None, + unit: Optional[Union[str, "UsageCount"]] = None, + **kwargs + ): + super(Usage, self).__init__(**kwargs) + self.current_value = current_value + self.limit = limit + self.name = name + self.unit = unit + + +class UsageListResponse(msrest.serialization.Model): + """List of usages. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param next_link: Link for next list of DedicatedCloudNode. + :type next_link: str + :ivar value: The list of usages. + :vartype value: list[~azure.mgmt.vmwarecloudsimple.models.Usage] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Usage]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + **kwargs + ): + super(UsageListResponse, self).__init__(**kwargs) + self.next_link = next_link + self.value = None + + +class UsageName(msrest.serialization.Model): + """User name model. + + :param localized_value: e.g. "Virtual Machines". + :type localized_value: str + :param value: resource type or resource type sku name, e.g. virtualMachines. + :type value: str + """ + + _attribute_map = { + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + localized_value: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): + super(UsageName, self).__init__(**kwargs) + self.localized_value = localized_value + self.value = value + + +class VirtualDisk(msrest.serialization.Model): + """Virtual disk model. + + 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 controller_id: Required. Disk's Controller id. + :type controller_id: str + :param independence_mode: Required. Disk's independence mode type. Possible values include: + "persistent", "independent_persistent", "independent_nonpersistent". + :type independence_mode: str or ~azure.mgmt.vmwarecloudsimple.models.DiskIndependenceMode + :param total_size: Required. Disk's total size. + :type total_size: int + :param virtual_disk_id: Disk's id. + :type virtual_disk_id: str + :ivar virtual_disk_name: Disk's display name. + :vartype virtual_disk_name: str + """ + + _validation = { + 'controller_id': {'required': True}, + 'independence_mode': {'required': True}, + 'total_size': {'required': True}, + 'virtual_disk_name': {'readonly': True}, + } + + _attribute_map = { + 'controller_id': {'key': 'controllerId', 'type': 'str'}, + 'independence_mode': {'key': 'independenceMode', 'type': 'str'}, + 'total_size': {'key': 'totalSize', 'type': 'int'}, + 'virtual_disk_id': {'key': 'virtualDiskId', 'type': 'str'}, + 'virtual_disk_name': {'key': 'virtualDiskName', 'type': 'str'}, + } + + def __init__( + self, + *, + controller_id: str, + independence_mode: Union[str, "DiskIndependenceMode"], + total_size: int, + virtual_disk_id: Optional[str] = None, + **kwargs + ): + super(VirtualDisk, self).__init__(**kwargs) + self.controller_id = controller_id + self.independence_mode = independence_mode + self.total_size = total_size + self.virtual_disk_id = virtual_disk_id + self.virtual_disk_name = None + + +class VirtualDiskController(msrest.serialization.Model): + """Virtual disk controller model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Controller's id. + :vartype id: str + :ivar name: The display name of Controller. + :vartype name: str + :ivar sub_type: dik controller subtype (VMWARE_PARAVIRTUAL, BUS_PARALLEL, LSI_PARALLEL, + LSI_SAS). + :vartype sub_type: str + :ivar type: disk controller type (SCSI). + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'sub_type': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'sub_type': {'key': 'subType', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualDiskController, self).__init__(**kwargs) + self.id = None + self.name = None + self.sub_type = None + self.type = None + + +class VirtualMachine(msrest.serialization.Model): + """Virtual machine model. + + 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: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/virtualMachines/{virtualMachineName}. + :vartype id: str + :param location: Required. Azure region. + :type location: str + :ivar name: {virtualMachineName}. + :vartype name: str + :param tags: A set of tags. The list of tags. + :type tags: dict[str, str] + :ivar type: {resourceProviderNamespace}/{resourceType}. + :vartype type: str + :param amount_of_ram: The amount of memory. + :type amount_of_ram: int + :ivar controllers: The list of Virtual Disks' Controllers. + :vartype controllers: list[~azure.mgmt.vmwarecloudsimple.models.VirtualDiskController] + :param customization: Virtual machine properties. + :type customization: ~azure.mgmt.vmwarecloudsimple.models.GuestOSCustomization + :param disks: The list of Virtual Disks. + :type disks: list[~azure.mgmt.vmwarecloudsimple.models.VirtualDisk] + :ivar dnsname: The DNS name of Virtual Machine in VCenter. + :vartype dnsname: str + :param expose_to_guest_vm: Expose Guest OS or not. + :type expose_to_guest_vm: bool + :ivar folder: The path to virtual machine folder in VCenter. + :vartype folder: str + :ivar guest_os: The name of Guest OS. + :vartype guest_os: str + :ivar guest_os_type: The Guest OS type. Possible values include: "linux", "windows", "other". + :vartype guest_os_type: str or ~azure.mgmt.vmwarecloudsimple.models.GuestOSType + :param nics: The list of Virtual NICs. + :type nics: list[~azure.mgmt.vmwarecloudsimple.models.VirtualNic] + :param number_of_cores: The number of CPU cores. + :type number_of_cores: int + :param password: Password for login. Deprecated - use customization property. + :type password: str + :param private_cloud_id: Private Cloud Id. + :type private_cloud_id: str + :ivar provisioning_state: The provisioning status of the resource. + :vartype provisioning_state: str + :ivar public_ip: The public ip of Virtual Machine. + :vartype public_ip: str + :param resource_pool: Virtual Machines Resource Pool. + :type resource_pool: ~azure.mgmt.vmwarecloudsimple.models.ResourcePool + :ivar status: The status of Virtual machine. Possible values include: "running", "suspended", + "poweredoff", "updating", "deallocating", "deleting". + :vartype status: str or ~azure.mgmt.vmwarecloudsimple.models.VirtualMachineStatus + :param template_id: Virtual Machine Template Id. + :type template_id: str + :param username: Username for login. Deprecated - use customization property. + :type username: str + :param v_sphere_networks: The list of Virtual VSphere Networks. + :type v_sphere_networks: list[str] + :ivar vm_id: The internal id of Virtual Machine in VCenter. + :vartype vm_id: str + :ivar vmwaretools: VMware tools version. + :vartype vmwaretools: str + """ + + _validation = { + 'id': {'readonly': True}, + 'location': {'required': True}, + 'name': {'readonly': True, 'pattern': r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'}, + 'type': {'readonly': True}, + 'controllers': {'readonly': True}, + 'dnsname': {'readonly': True}, + 'folder': {'readonly': True}, + 'guest_os': {'readonly': True}, + 'guest_os_type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'public_ip': {'readonly': True}, + 'status': {'readonly': True}, + 'vm_id': {'readonly': True}, + 'vmwaretools': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'type': {'key': 'type', 'type': 'str'}, + 'amount_of_ram': {'key': 'properties.amountOfRam', 'type': 'int'}, + 'controllers': {'key': 'properties.controllers', 'type': '[VirtualDiskController]'}, + 'customization': {'key': 'properties.customization', 'type': 'GuestOSCustomization'}, + 'disks': {'key': 'properties.disks', 'type': '[VirtualDisk]'}, + 'dnsname': {'key': 'properties.dnsname', 'type': 'str'}, + 'expose_to_guest_vm': {'key': 'properties.exposeToGuestVM', 'type': 'bool'}, + 'folder': {'key': 'properties.folder', 'type': 'str'}, + 'guest_os': {'key': 'properties.guestOS', 'type': 'str'}, + 'guest_os_type': {'key': 'properties.guestOSType', 'type': 'str'}, + 'nics': {'key': 'properties.nics', 'type': '[VirtualNic]'}, + 'number_of_cores': {'key': 'properties.numberOfCores', 'type': 'int'}, + 'password': {'key': 'properties.password', 'type': 'str'}, + 'private_cloud_id': {'key': 'properties.privateCloudId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'public_ip': {'key': 'properties.publicIP', 'type': 'str'}, + 'resource_pool': {'key': 'properties.resourcePool', 'type': 'ResourcePool'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'template_id': {'key': 'properties.templateId', 'type': 'str'}, + 'username': {'key': 'properties.username', 'type': 'str'}, + 'v_sphere_networks': {'key': 'properties.vSphereNetworks', 'type': '[str]'}, + 'vm_id': {'key': 'properties.vmId', 'type': 'str'}, + 'vmwaretools': {'key': 'properties.vmwaretools', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + amount_of_ram: Optional[int] = None, + customization: Optional["GuestOSCustomization"] = None, + disks: Optional[List["VirtualDisk"]] = None, + expose_to_guest_vm: Optional[bool] = None, + nics: Optional[List["VirtualNic"]] = None, + number_of_cores: Optional[int] = None, + password: Optional[str] = None, + private_cloud_id: Optional[str] = None, + resource_pool: Optional["ResourcePool"] = None, + template_id: Optional[str] = None, + username: Optional[str] = None, + v_sphere_networks: Optional[List[str]] = None, + **kwargs + ): + super(VirtualMachine, self).__init__(**kwargs) + self.id = None + self.location = location + self.name = None + self.tags = tags + self.type = None + self.amount_of_ram = amount_of_ram + self.controllers = None + self.customization = customization + self.disks = disks + self.dnsname = None + self.expose_to_guest_vm = expose_to_guest_vm + self.folder = None + self.guest_os = None + self.guest_os_type = None + self.nics = nics + self.number_of_cores = number_of_cores + self.password = password + self.private_cloud_id = private_cloud_id + self.provisioning_state = None + self.public_ip = None + self.resource_pool = resource_pool + self.status = None + self.template_id = template_id + self.username = username + self.v_sphere_networks = v_sphere_networks + self.vm_id = None + self.vmwaretools = None + + +class VirtualMachineListResponse(msrest.serialization.Model): + """List of virtual machines. + + :param next_link: Link for next list of VirtualMachines. + :type next_link: str + :param value: Results of the VirtualMachine list. + :type value: list[~azure.mgmt.vmwarecloudsimple.models.VirtualMachine] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[VirtualMachine]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["VirtualMachine"]] = None, + **kwargs + ): + super(VirtualMachineListResponse, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class VirtualMachineStopMode(msrest.serialization.Model): + """List of virtual machine stop modes. + + :param mode: mode indicates a type of stop operation - reboot, suspend, shutdown or power-off. + Possible values include: "reboot", "suspend", "shutdown", "poweroff". + :type mode: str or ~azure.mgmt.vmwarecloudsimple.models.StopMode + """ + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + } + + def __init__( + self, + *, + mode: Optional[Union[str, "StopMode"]] = None, + **kwargs + ): + super(VirtualMachineStopMode, self).__init__(**kwargs) + self.mode = mode + + +class VirtualMachineTemplate(msrest.serialization.Model): + """Virtual machine template model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: virtual machine template id (privateCloudId:vsphereId). + :vartype id: str + :param location: Azure region. + :type location: str + :ivar name: {virtualMachineTemplateName}. + :vartype name: str + :ivar type: {resourceProviderNamespace}/{resourceType}. + :vartype type: str + :param amount_of_ram: The amount of memory. + :type amount_of_ram: int + :param controllers: The list of Virtual Disk Controllers. + :type controllers: list[~azure.mgmt.vmwarecloudsimple.models.VirtualDiskController] + :param description: The description of Virtual Machine Template. + :type description: str + :param disks: The list of Virtual Disks. + :type disks: list[~azure.mgmt.vmwarecloudsimple.models.VirtualDisk] + :param expose_to_guest_vm: Expose Guest OS or not. + :type expose_to_guest_vm: bool + :ivar guest_os: The Guest OS. + :vartype guest_os: str + :ivar guest_os_type: The Guest OS types. + :vartype guest_os_type: str + :param nics: The list of Virtual NICs. + :type nics: list[~azure.mgmt.vmwarecloudsimple.models.VirtualNic] + :param number_of_cores: The number of CPU cores. + :type number_of_cores: int + :param path: path to folder. + :type path: str + :param private_cloud_id: The Private Cloud Id. + :type private_cloud_id: str + :param v_sphere_networks: The list of VSphere networks. + :type v_sphere_networks: list[str] + :param v_sphere_tags: The tags from VSphere. + :type v_sphere_tags: list[str] + :ivar vmwaretools: The VMware tools version. + :vartype vmwaretools: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'guest_os': {'readonly': True}, + 'guest_os_type': {'readonly': True}, + 'vmwaretools': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'amount_of_ram': {'key': 'properties.amountOfRam', 'type': 'int'}, + 'controllers': {'key': 'properties.controllers', 'type': '[VirtualDiskController]'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'disks': {'key': 'properties.disks', 'type': '[VirtualDisk]'}, + 'expose_to_guest_vm': {'key': 'properties.exposeToGuestVM', 'type': 'bool'}, + 'guest_os': {'key': 'properties.guestOS', 'type': 'str'}, + 'guest_os_type': {'key': 'properties.guestOSType', 'type': 'str'}, + 'nics': {'key': 'properties.nics', 'type': '[VirtualNic]'}, + 'number_of_cores': {'key': 'properties.numberOfCores', 'type': 'int'}, + 'path': {'key': 'properties.path', 'type': 'str'}, + 'private_cloud_id': {'key': 'properties.privateCloudId', 'type': 'str'}, + 'v_sphere_networks': {'key': 'properties.vSphereNetworks', 'type': '[str]'}, + 'v_sphere_tags': {'key': 'properties.vSphereTags', 'type': '[str]'}, + 'vmwaretools': {'key': 'properties.vmwaretools', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + amount_of_ram: Optional[int] = None, + controllers: Optional[List["VirtualDiskController"]] = None, + description: Optional[str] = None, + disks: Optional[List["VirtualDisk"]] = None, + expose_to_guest_vm: Optional[bool] = None, + nics: Optional[List["VirtualNic"]] = None, + number_of_cores: Optional[int] = None, + path: Optional[str] = None, + private_cloud_id: Optional[str] = None, + v_sphere_networks: Optional[List[str]] = None, + v_sphere_tags: Optional[List[str]] = None, + **kwargs + ): + super(VirtualMachineTemplate, self).__init__(**kwargs) + self.id = None + self.location = location + self.name = None + self.type = None + self.amount_of_ram = amount_of_ram + self.controllers = controllers + self.description = description + self.disks = disks + self.expose_to_guest_vm = expose_to_guest_vm + self.guest_os = None + self.guest_os_type = None + self.nics = nics + self.number_of_cores = number_of_cores + self.path = path + self.private_cloud_id = private_cloud_id + self.v_sphere_networks = v_sphere_networks + self.v_sphere_tags = v_sphere_tags + self.vmwaretools = None + + +class VirtualMachineTemplateListResponse(msrest.serialization.Model): + """List of virtual machine templates. + + :param next_link: Link for next list of VirtualMachineTemplate. + :type next_link: str + :param value: Results of the VM template list. + :type value: list[~azure.mgmt.vmwarecloudsimple.models.VirtualMachineTemplate] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[VirtualMachineTemplate]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["VirtualMachineTemplate"]] = None, + **kwargs + ): + super(VirtualMachineTemplateListResponse, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class VirtualNetwork(msrest.serialization.Model): + """Virtual network model. + + 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 assignable: can be used in vm creation/deletion. + :vartype assignable: bool + :param id: Required. virtual network id (privateCloudId:vsphereId). + :type id: str + :ivar location: Azure region. + :vartype location: str + :ivar name: {VirtualNetworkName}. + :vartype name: str + :ivar type: {resourceProviderNamespace}/{resourceType}. + :vartype type: str + :ivar private_cloud_id: The Private Cloud id. + :vartype private_cloud_id: str + """ + + _validation = { + 'assignable': {'readonly': True}, + 'id': {'required': True}, + 'location': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'private_cloud_id': {'readonly': True}, + } + + _attribute_map = { + 'assignable': {'key': 'assignable', 'type': 'bool'}, + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_cloud_id': {'key': 'properties.privateCloudId', 'type': 'str'}, + } + + def __init__( + self, + *, + id: str, + **kwargs + ): + super(VirtualNetwork, self).__init__(**kwargs) + self.assignable = None + self.id = id + self.location = None + self.name = None + self.type = None + self.private_cloud_id = None + + +class VirtualNetworkListResponse(msrest.serialization.Model): + """List of virtual networks. + + :param next_link: Link for next list of VirtualNetwork. + :type next_link: str + :param value: Results of the VirtualNetwork list. + :type value: list[~azure.mgmt.vmwarecloudsimple.models.VirtualNetwork] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[VirtualNetwork]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["VirtualNetwork"]] = None, + **kwargs + ): + super(VirtualNetworkListResponse, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class VirtualNic(msrest.serialization.Model): + """Virtual NIC model. + + 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 customization: guest OS customization for nic. + :type customization: ~azure.mgmt.vmwarecloudsimple.models.GuestOSNICCustomization + :param ip_addresses: NIC ip address. + :type ip_addresses: list[str] + :param mac_address: NIC MAC address. + :type mac_address: str + :param network: Required. Virtual Network. + :type network: ~azure.mgmt.vmwarecloudsimple.models.VirtualNetwork + :param nic_type: Required. NIC type. Possible values include: "E1000", "E1000E", "PCNET32", + "VMXNET", "VMXNET2", "VMXNET3". + :type nic_type: str or ~azure.mgmt.vmwarecloudsimple.models.NICType + :param power_on_boot: Is NIC powered on/off on boot. + :type power_on_boot: bool + :param virtual_nic_id: NIC id. + :type virtual_nic_id: str + :ivar virtual_nic_name: NIC name. + :vartype virtual_nic_name: str + """ + + _validation = { + 'network': {'required': True}, + 'nic_type': {'required': True}, + 'virtual_nic_name': {'readonly': True}, + } + + _attribute_map = { + 'customization': {'key': 'customization', 'type': 'GuestOSNICCustomization'}, + 'ip_addresses': {'key': 'ipAddresses', 'type': '[str]'}, + 'mac_address': {'key': 'macAddress', 'type': 'str'}, + 'network': {'key': 'network', 'type': 'VirtualNetwork'}, + 'nic_type': {'key': 'nicType', 'type': 'str'}, + 'power_on_boot': {'key': 'powerOnBoot', 'type': 'bool'}, + 'virtual_nic_id': {'key': 'virtualNicId', 'type': 'str'}, + 'virtual_nic_name': {'key': 'virtualNicName', 'type': 'str'}, + } + + def __init__( + self, + *, + network: "VirtualNetwork", + nic_type: Union[str, "NICType"], + customization: Optional["GuestOSNICCustomization"] = None, + ip_addresses: Optional[List[str]] = None, + mac_address: Optional[str] = None, + power_on_boot: Optional[bool] = None, + virtual_nic_id: Optional[str] = None, + **kwargs + ): + super(VirtualNic, self).__init__(**kwargs) + self.customization = customization + self.ip_addresses = ip_addresses + self.mac_address = mac_address + self.network = network + self.nic_type = nic_type + self.power_on_boot = power_on_boot + self.virtual_nic_id = virtual_nic_id + self.virtual_nic_name = None diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/models/_vmware_cloud_simple_enums.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/models/_vmware_cloud_simple_enums.py new file mode 100644 index 000000000000..3dd1a702ee6e --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/models/_vmware_cloud_simple_enums.py @@ -0,0 +1,157 @@ +# 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 AggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Metric's aggregation type for e.g. (Average, Total) + """ + + AVERAGE = "Average" + TOTAL = "Total" + +class CustomizationHostNameType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of host name + """ + + USER_DEFINED = "USER_DEFINED" + PREFIX_BASED = "PREFIX_BASED" + FIXED = "FIXED" + VIRTUAL_MACHINE_NAME = "VIRTUAL_MACHINE_NAME" + CUSTOM_NAME = "CUSTOM_NAME" + +class CustomizationIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Identity type + """ + + WINDOWS_TEXT = "WINDOWS_TEXT" + WINDOWS = "WINDOWS" + LINUX = "LINUX" + +class CustomizationIPAddressType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Customization Specification ip type + """ + + CUSTOM = "CUSTOM" + DHCP_IP = "DHCP_IP" + FIXED_IP = "FIXED_IP" + USER_DEFINED = "USER_DEFINED" + +class CustomizationPolicyPropertiesType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of customization (Linux or Windows) + """ + + LINUX = "LINUX" + WINDOWS = "WINDOWS" + +class DiskIndependenceMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Disk's independence mode type + """ + + PERSISTENT = "persistent" + INDEPENDENT_PERSISTENT = "independent_persistent" + INDEPENDENT_NONPERSISTENT = "independent_nonpersistent" + +class GuestOSNICCustomizationAllocation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """IP address allocation method + """ + + STATIC = "static" + DYNAMIC = "dynamic" + +class GuestOSType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The Guest OS type + """ + + LINUX = "linux" + WINDOWS = "windows" + OTHER = "other" + +class NICType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """NIC type + """ + + E1000 = "E1000" + E1000_E = "E1000E" + PCNET32 = "PCNET32" + VMXNET = "VMXNET" + VMXNET2 = "VMXNET2" + VMXNET3 = "VMXNET3" + +class NodeStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Node status, indicates is private cloud set up on this node or not + """ + + UNUSED = "unused" + USED = "used" + +class OnboardingStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """indicates whether account onboarded or not in a given region + """ + + NOT_ON_BOARDED = "notOnBoarded" + ON_BOARDED = "onBoarded" + ON_BOARDING_FAILED = "onBoardingFailed" + ON_BOARDING = "onBoarding" + +class OperationOrigin(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The origin of operation + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + +class StopMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """mode indicates a type of stop operation - reboot, suspend, shutdown or power-off + """ + + REBOOT = "reboot" + SUSPEND = "suspend" + SHUTDOWN = "shutdown" + POWEROFF = "poweroff" + +class UsageCount(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The usages' unit + """ + + COUNT = "Count" + BYTES = "Bytes" + SECONDS = "Seconds" + PERCENT = "Percent" + COUNT_PER_SECOND = "CountPerSecond" + BYTES_PER_SECOND = "BytesPerSecond" + +class VirtualMachineStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of Virtual machine + """ + + RUNNING = "running" + SUSPENDED = "suspended" + POWEREDOFF = "poweredoff" + UPDATING = "updating" + DEALLOCATING = "deallocating" + DELETING = "deleting" diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/__init__.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/__init__.py new file mode 100644 index 000000000000..b0acb1dfd4ae --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/__init__.py @@ -0,0 +1,33 @@ +# 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 ._dedicated_cloud_nodes_operations import DedicatedCloudNodesOperations +from ._dedicated_cloud_services_operations import DedicatedCloudServicesOperations +from ._skus_availability_operations import SkusAvailabilityOperations +from ._private_clouds_operations import PrivateCloudsOperations +from ._customization_policies_operations import CustomizationPoliciesOperations +from ._resource_pools_operations import ResourcePoolsOperations +from ._virtual_machine_templates_operations import VirtualMachineTemplatesOperations +from ._virtual_networks_operations import VirtualNetworksOperations +from ._usages_operations import UsagesOperations +from ._virtual_machines_operations import VirtualMachinesOperations + +__all__ = [ + 'Operations', + 'DedicatedCloudNodesOperations', + 'DedicatedCloudServicesOperations', + 'SkusAvailabilityOperations', + 'PrivateCloudsOperations', + 'CustomizationPoliciesOperations', + 'ResourcePoolsOperations', + 'VirtualMachineTemplatesOperations', + 'VirtualNetworksOperations', + 'UsagesOperations', + 'VirtualMachinesOperations', +] diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_customization_policies_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_customization_policies_operations.py new file mode 100644 index 000000000000..59b45348bbb5 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_customization_policies_operations.py @@ -0,0 +1,196 @@ +# 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 CustomizationPoliciesOperations(object): + """CustomizationPoliciesOperations 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.vmwarecloudsimple.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, + region_id, # type: str + pc_name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CustomizationPoliciesListResponse"] + """Implements get of customization policies list. + + Returns list of customization policies in region for private cloud. + + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param pc_name: The private cloud name. + :type pc_name: str + :param filter: The filter to apply on the list operation. only type is allowed here as a filter + e.g. $filter=type eq 'xxxx'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomizationPoliciesListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.vmwarecloudsimple.models.CustomizationPoliciesListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomizationPoliciesListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_id, 'str'), + 'pcName': self._serialize.url("pc_name", pc_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') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, '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('CustomizationPoliciesListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/customizationPolicies'} # type: ignore + + def get( + self, + region_id, # type: str + pc_name, # type: str + customization_policy_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomizationPolicy" + """Implements get of customization policy. + + Returns customization policy by its name. + + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param pc_name: The private cloud name. + :type pc_name: str + :param customization_policy_name: customization policy name. + :type customization_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomizationPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.CustomizationPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomizationPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_id, 'str'), + 'pcName': self._serialize.url("pc_name", pc_name, 'str'), + 'customizationPolicyName': self._serialize.url("customization_policy_name", customization_policy_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) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomizationPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/customizationPolicies/{customizationPolicyName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_dedicated_cloud_nodes_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_dedicated_cloud_nodes_operations.py new file mode 100644 index 000000000000..427faba42844 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_dedicated_cloud_nodes_operations.py @@ -0,0 +1,552 @@ +# 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 DedicatedCloudNodesOperations(object): + """DedicatedCloudNodesOperations 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.vmwarecloudsimple.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_by_subscription( + self, + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DedicatedCloudNodeListResponse"] + """Implements list of dedicated cloud nodes within subscription method. + + Returns list of dedicate cloud nodes within subscription. + + :param filter: The filter to apply on the list operation. + :type filter: str + :param top: The maximum number of record sets to return. + :type top: int + :param skip_token: to be used by nextLink implementation. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DedicatedCloudNodeListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudNodeListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudNodeListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, '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('DedicatedCloudNodeListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudNodes'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DedicatedCloudNodeListResponse"] + """Implements list of dedicated cloud nodes within RG method. + + Returns list of dedicate cloud nodes within resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param filter: The filter to apply on the list operation. + :type filter: str + :param top: The maximum number of record sets to return. + :type top: int + :param skip_token: to be used by nextLink implementation. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DedicatedCloudNodeListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudNodeListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudNodeListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, '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('DedicatedCloudNodeListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudNodes'} # type: ignore + + def get( + self, + resource_group_name, # type: str + dedicated_cloud_node_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DedicatedCloudNode" + """Implements dedicated cloud node GET method. + + Returns dedicated cloud node. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dedicated_cloud_node_name: dedicated cloud node name. + :type dedicated_cloud_node_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedCloudNode, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudNode + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudNode"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dedicatedCloudNodeName': self._serialize.url("dedicated_cloud_node_name", dedicated_cloud_node_name, 'str', pattern=r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'), + } + 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) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedCloudNode', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudNodes/{dedicatedCloudNodeName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + dedicated_cloud_node_name, # type: str + dedicated_cloud_node_request, # type: "_models.DedicatedCloudNode" + **kwargs # type: Any + ): + # type: (...) -> "_models.DedicatedCloudNode" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudNode"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dedicatedCloudNodeName': self._serialize.url("dedicated_cloud_node_name", dedicated_cloud_node_name, 'str', pattern=r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'), + } + 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['Referer'] = self._serialize.header("self._config.referer", self._config.referer, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(dedicated_cloud_node_request, 'DedicatedCloudNode') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + deserialized = self._deserialize('DedicatedCloudNode', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudNodes/{dedicatedCloudNodeName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + dedicated_cloud_node_name, # type: str + dedicated_cloud_node_request, # type: "_models.DedicatedCloudNode" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DedicatedCloudNode"] + """Implements dedicated cloud node PUT method. + + Returns dedicated cloud node by its name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dedicated_cloud_node_name: dedicated cloud node name. + :type dedicated_cloud_node_name: str + :param dedicated_cloud_node_request: Create Dedicated Cloud Node request. + :type dedicated_cloud_node_request: ~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudNode + :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 DedicatedCloudNode or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudNode] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudNode"] + 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, + dedicated_cloud_node_name=dedicated_cloud_node_name, + dedicated_cloud_node_request=dedicated_cloud_node_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + deserialized = self._deserialize('DedicatedCloudNode', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dedicatedCloudNodeName': self._serialize.url("dedicated_cloud_node_name", dedicated_cloud_node_name, 'str', pattern=r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'), + } + + 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.VMwareCloudSimple/dedicatedCloudNodes/{dedicatedCloudNodeName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + dedicated_cloud_node_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Implements dedicated cloud node DELETE method. + + Delete dedicated cloud node. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dedicated_cloud_node_name: dedicated cloud node name. + :type dedicated_cloud_node_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 = "2019-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dedicatedCloudNodeName': self._serialize.url("dedicated_cloud_node_name", dedicated_cloud_node_name, 'str', pattern=r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'), + } + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudNodes/{dedicatedCloudNodeName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + dedicated_cloud_node_name, # type: str + dedicated_cloud_node_request, # type: "_models.PatchPayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.DedicatedCloudNode" + """Implements dedicated cloud node PATCH method. + + Patches dedicated node properties. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dedicated_cloud_node_name: dedicated cloud node name. + :type dedicated_cloud_node_name: str + :param dedicated_cloud_node_request: Patch Dedicated Cloud Node request. + :type dedicated_cloud_node_request: ~azure.mgmt.vmwarecloudsimple.models.PatchPayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedCloudNode, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudNode + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudNode"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dedicatedCloudNodeName': self._serialize.url("dedicated_cloud_node_name", dedicated_cloud_node_name, 'str', pattern=r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'), + } + 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(dedicated_cloud_node_request, 'PatchPayload') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedCloudNode', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudNodes/{dedicatedCloudNodeName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_dedicated_cloud_services_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_dedicated_cloud_services_operations.py new file mode 100644 index 000000000000..a8c72ce2dadf --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_dedicated_cloud_services_operations.py @@ -0,0 +1,537 @@ +# 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 DedicatedCloudServicesOperations(object): + """DedicatedCloudServicesOperations 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.vmwarecloudsimple.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_by_subscription( + self, + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DedicatedCloudServiceListResponse"] + """Implements list of dedicatedCloudService objects within subscription method. + + Returns list of dedicated cloud services within a subscription. + + :param filter: The filter to apply on the list operation. + :type filter: str + :param top: The maximum number of record sets to return. + :type top: int + :param skip_token: to be used by nextLink implementation. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DedicatedCloudServiceListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudServiceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudServiceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, '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('DedicatedCloudServiceListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudServices'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DedicatedCloudServiceListResponse"] + """Implements list of dedicatedCloudService objects within RG method. + + Returns list of dedicated cloud services within a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param filter: The filter to apply on the list operation. + :type filter: str + :param top: The maximum number of record sets to return. + :type top: int + :param skip_token: to be used by nextLink implementation. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DedicatedCloudServiceListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudServiceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudServiceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, '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('DedicatedCloudServiceListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudServices'} # type: ignore + + def get( + self, + resource_group_name, # type: str + dedicated_cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DedicatedCloudService" + """Implements dedicatedCloudService GET method. + + Returns Dedicate Cloud Service. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dedicated_cloud_service_name: dedicated cloud Service name. + :type dedicated_cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedCloudService, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dedicatedCloudServiceName': self._serialize.url("dedicated_cloud_service_name", dedicated_cloud_service_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) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedCloudService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudServices/{dedicatedCloudServiceName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + dedicated_cloud_service_name, # type: str + dedicated_cloud_service_request, # type: "_models.DedicatedCloudService" + **kwargs # type: Any + ): + # type: (...) -> "_models.DedicatedCloudService" + """Implements dedicated cloud service PUT method. + + Create dedicate cloud service. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dedicated_cloud_service_name: dedicated cloud Service name. + :type dedicated_cloud_service_name: str + :param dedicated_cloud_service_request: Create Dedicated Cloud Service request. + :type dedicated_cloud_service_request: ~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudService + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedCloudService, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dedicatedCloudServiceName': self._serialize.url("dedicated_cloud_service_name", dedicated_cloud_service_name, 'str', pattern=r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'), + } + 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(dedicated_cloud_service_request, 'DedicatedCloudService') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedCloudService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudServices/{dedicatedCloudServiceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + dedicated_cloud_service_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 = "2019-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dedicatedCloudServiceName': self._serialize.url("dedicated_cloud_service_name", dedicated_cloud_service_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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudServices/{dedicatedCloudServiceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + dedicated_cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Implements dedicatedCloudService DELETE method. + + Delete dedicate cloud service. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dedicated_cloud_service_name: dedicated cloud service name. + :type dedicated_cloud_service_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, + dedicated_cloud_service_name=dedicated_cloud_service_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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dedicatedCloudServiceName': self._serialize.url("dedicated_cloud_service_name", dedicated_cloud_service_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.VMwareCloudSimple/dedicatedCloudServices/{dedicatedCloudServiceName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + dedicated_cloud_service_name, # type: str + dedicated_cloud_service_request, # type: "_models.PatchPayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.DedicatedCloudService" + """Implements dedicatedCloudService PATCH method. + + Patch dedicated cloud service's properties. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dedicated_cloud_service_name: dedicated cloud service name. + :type dedicated_cloud_service_name: str + :param dedicated_cloud_service_request: Patch Dedicated Cloud Service request. + :type dedicated_cloud_service_request: ~azure.mgmt.vmwarecloudsimple.models.PatchPayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedCloudService, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.DedicatedCloudService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedCloudService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dedicatedCloudServiceName': self._serialize.url("dedicated_cloud_service_name", dedicated_cloud_service_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(dedicated_cloud_service_request, 'PatchPayload') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedCloudService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudServices/{dedicatedCloudServiceName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_operations.py new file mode 100644 index 000000000000..bab3484da670 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_operations.py @@ -0,0 +1,182 @@ +# 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.vmwarecloudsimple.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.AvailableOperationsListResponse"] + """Implements list of available operations. + + Return list of operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableOperationsListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.vmwarecloudsimple.models.AvailableOperationsListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperationsListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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('AvailableOperationsListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.VMwareCloudSimple/operations'} # type: ignore + + def get( + self, + region_id, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.OperationResource"] + """Implements get of async operation. + + Return an async operation. + + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param operation_id: operation id. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationResource, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.OperationResource or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_id, 'str'), + 'operationId': self._serialize.url("operation_id", operation_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['Referer'] = self._serialize.header("self._config.referer", self._config.referer, 'str') + 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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationResource', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/operationResults/{operationId}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_private_clouds_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_private_clouds_operations.py new file mode 100644 index 000000000000..d4c9753ca99b --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_private_clouds_operations.py @@ -0,0 +1,182 @@ +# 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 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.vmwarecloudsimple.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, + region_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateCloudList"] + """Implements private cloud list GET method. + + Returns list of private clouds in particular region. + + :param region_id: The region Id (westus, eastus). + :type region_id: 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.vmwarecloudsimple.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 = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_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') + + 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds'} # type: ignore + + def get( + self, + pc_name, # type: str + region_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateCloud" + """Implements private cloud GET method. + + Returns private cloud by its name. + + :param pc_name: The private cloud name. + :type pc_name: str + :param region_id: The region Id (westus, eastus). + :type region_id: 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.vmwarecloudsimple.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 = "2019-04-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'), + 'pcName': self._serialize.url("pc_name", pc_name, 'str'), + 'regionId': self._serialize.url("region_id", region_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) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateCloud', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_resource_pools_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_resource_pools_operations.py new file mode 100644 index 000000000000..242176bf7460 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_resource_pools_operations.py @@ -0,0 +1,190 @@ +# 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 ResourcePoolsOperations(object): + """ResourcePoolsOperations 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.vmwarecloudsimple.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, + region_id, # type: str + pc_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ResourcePoolsListResponse"] + """Implements get of resource pools list. + + Returns list of resource pools in region for private cloud. + + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param pc_name: The private cloud name. + :type pc_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourcePoolsListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.vmwarecloudsimple.models.ResourcePoolsListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourcePoolsListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_id, 'str'), + 'pcName': self._serialize.url("pc_name", pc_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('ResourcePoolsListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/resourcePools'} # type: ignore + + def get( + self, + region_id, # type: str + pc_name, # type: str + resource_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourcePool" + """Implements get of resource pool. + + Returns resource pool templates by its name. + + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param pc_name: The private cloud name. + :type pc_name: str + :param resource_pool_name: resource pool id (vsphereId). + :type resource_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourcePool, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.ResourcePool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourcePool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_id, 'str'), + 'pcName': self._serialize.url("pc_name", pc_name, 'str'), + 'resourcePoolName': self._serialize.url("resource_pool_name", resource_pool_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) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourcePool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/resourcePools/{resourcePoolName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_skus_availability_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_skus_availability_operations.py new file mode 100644 index 000000000000..cf387d1186a0 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_skus_availability_operations.py @@ -0,0 +1,125 @@ +# 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 SkusAvailabilityOperations(object): + """SkusAvailabilityOperations 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.vmwarecloudsimple.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, + region_id, # type: str + sku_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SkuAvailabilityListResponse"] + """Implements SkuAvailability List method. + + Returns list of available resources in region. + + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param sku_id: sku id, if no sku is passed availability for all skus will be returned. + :type sku_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuAvailabilityListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.vmwarecloudsimple.models.SkuAvailabilityListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SkuAvailabilityListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if sku_id is not None: + query_parameters['skuId'] = self._serialize.query("sku_id", sku_id, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SkuAvailabilityListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/availabilities'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_usages_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_usages_operations.py new file mode 100644 index 000000000000..b74d6d9845e5 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_usages_operations.py @@ -0,0 +1,126 @@ +# 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 UsagesOperations(object): + """UsagesOperations 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.vmwarecloudsimple.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, + region_id, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.UsageListResponse"] + """Implements Usages List method. + + Returns list of usage in region. + + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param filter: The filter to apply on the list operation. only name.value is allowed here as a + filter e.g. $filter=name.value eq 'xxxx'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UsageListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.vmwarecloudsimple.models.UsageListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('UsageListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/usages'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_virtual_machine_templates_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_virtual_machine_templates_operations.py new file mode 100644 index 000000000000..1802d58eb3b5 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_virtual_machine_templates_operations.py @@ -0,0 +1,195 @@ +# 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 VirtualMachineTemplatesOperations(object): + """VirtualMachineTemplatesOperations 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.vmwarecloudsimple.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, + pc_name, # type: str + region_id, # type: str + resource_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VirtualMachineTemplateListResponse"] + """Implements list of available VM templates. + + Returns list of virtual machine templates in region for private cloud. + + :param pc_name: The private cloud name. + :type pc_name: str + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param resource_pool_name: Resource pool used to derive vSphere cluster which contains VM + templates. + :type resource_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineTemplateListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.vmwarecloudsimple.models.VirtualMachineTemplateListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineTemplateListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'pcName': self._serialize.url("pc_name", pc_name, 'str'), + 'regionId': self._serialize.url("region_id", region_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') + query_parameters['resourcePoolName'] = self._serialize.query("resource_pool_name", resource_pool_name, '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('VirtualMachineTemplateListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/virtualMachineTemplates'} # type: ignore + + def get( + self, + region_id, # type: str + pc_name, # type: str + virtual_machine_template_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineTemplate" + """Implements virtual machine template GET method. + + Returns virtual machine templates by its name. + + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param pc_name: The private cloud name. + :type pc_name: str + :param virtual_machine_template_name: virtual machine template id (vsphereId). + :type virtual_machine_template_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineTemplate, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.VirtualMachineTemplate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineTemplate"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_id, 'str'), + 'pcName': self._serialize.url("pc_name", pc_name, 'str'), + 'virtualMachineTemplateName': self._serialize.url("virtual_machine_template_name", virtual_machine_template_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) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineTemplate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/virtualMachineTemplates/{virtualMachineTemplateName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_virtual_machines_operations.py new file mode 100644 index 000000000000..2afc398d0a19 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_virtual_machines_operations.py @@ -0,0 +1,933 @@ +# 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 VirtualMachinesOperations(object): + """VirtualMachinesOperations 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.vmwarecloudsimple.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_by_subscription( + self, + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VirtualMachineListResponse"] + """Implements list virtual machine within subscription method. + + Returns list virtual machine within subscription. + + :param filter: The filter to apply on the list operation. + :type filter: str + :param top: The maximum number of record sets to return. + :type top: int + :param skip_token: to be used by nextLink implementation. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.vmwarecloudsimple.models.VirtualMachineListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, '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('VirtualMachineListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/virtualMachines'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VirtualMachineListResponse"] + """Implements list virtual machine within RG method. + + Returns list of virtual machine within resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param filter: The filter to apply on the list operation. + :type filter: str + :param top: The maximum number of record sets to return. + :type top: int + :param skip_token: to be used by nextLink implementation. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.vmwarecloudsimple.models.VirtualMachineListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, '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('VirtualMachineListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines'} # type: ignore + + def get( + self, + resource_group_name, # type: str + virtual_machine_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachine" + """Implements virtual machine GET method. + + Get virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_machine_name: virtual machine name. + :type virtual_machine_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachine, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.VirtualMachine + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_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) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + virtual_machine_name, # type: str + virtual_machine_request, # type: "_models.VirtualMachine" + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachine" + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', pattern=r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'), + } + 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['Referer'] = self._serialize.header("self._config.referer", self._config.referer, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(virtual_machine_request, 'VirtualMachine') + 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) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if response.status_code == 201: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + virtual_machine_name, # type: str + virtual_machine_request, # type: "_models.VirtualMachine" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualMachine"] + """Implements virtual machine PUT method. + + Create Or Update Virtual Machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_machine_name: virtual machine name. + :type virtual_machine_name: str + :param virtual_machine_request: Create or Update Virtual Machine request. + :type virtual_machine_request: ~azure.mgmt.vmwarecloudsimple.models.VirtualMachine + :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 VirtualMachine or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.vmwarecloudsimple.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + 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, + virtual_machine_name=virtual_machine_name, + virtual_machine_request=virtual_machine_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', pattern=r'^[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?$'), + } + + 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.VMwareCloudSimple/virtualMachines/{virtualMachineName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + virtual_machine_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 = "2019-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_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['Referer'] = self._serialize.header("self._config.referer", self._config.referer, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + virtual_machine_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Implements virtual machine DELETE method. + + Delete virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_machine_name: virtual machine name. + :type virtual_machine_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, + virtual_machine_name=virtual_machine_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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_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.VMwareCloudSimple/virtualMachines/{virtualMachineName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + virtual_machine_name, # type: str + virtual_machine_request, # type: "_models.PatchPayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachine" + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_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(virtual_machine_request, 'PatchPayload') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + virtual_machine_name, # type: str + virtual_machine_request, # type: "_models.PatchPayload" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualMachine"] + """Implements virtual machine PATCH method. + + Patch virtual machine properties. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_machine_name: virtual machine name. + :type virtual_machine_name: str + :param virtual_machine_request: Patch virtual machine request. + :type virtual_machine_request: ~azure.mgmt.vmwarecloudsimple.models.PatchPayload + :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 VirtualMachine or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.vmwarecloudsimple.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + 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, + virtual_machine_name=virtual_machine_name, + virtual_machine_request=virtual_machine_request, + 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('VirtualMachine', 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_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.VMwareCloudSimple/virtualMachines/{virtualMachineName}'} # type: ignore + + def _start_initial( + self, + resource_group_name, # type: str + virtual_machine_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 = "2019-04-01" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_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['Referer'] = self._serialize.header("self._config.referer", self._config.referer, 'str') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}/start'} # type: ignore + + def begin_start( + self, + resource_group_name, # type: str + virtual_machine_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Implements a start method for a virtual machine. + + Power on virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_machine_name: virtual machine name. + :type virtual_machine_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._start_initial( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_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_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}/start'} # type: ignore + + def _stop_initial( + self, + resource_group_name, # type: str + virtual_machine_name, # type: str + mode=None, # type: Optional[Union[str, "_models.StopMode"]] + m=None, # type: Optional["_models.VirtualMachineStopMode"] + **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 = "2019-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if mode is not None: + query_parameters['mode'] = self._serialize.query("mode", mode, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Referer'] = self._serialize.header("self._config.referer", self._config.referer, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if m is not None: + body_content = self._serialize.body(m, 'VirtualMachineStopMode') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}/stop'} # type: ignore + + def begin_stop( + self, + resource_group_name, # type: str + virtual_machine_name, # type: str + mode=None, # type: Optional[Union[str, "_models.StopMode"]] + m=None, # type: Optional["_models.VirtualMachineStopMode"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Implements shutdown, poweroff, and suspend method for a virtual machine. + + Power off virtual machine, options: shutdown, poweroff, and suspend. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_machine_name: virtual machine name. + :type virtual_machine_name: str + :param mode: query stop mode parameter (reboot, shutdown, etc...). + :type mode: str or ~azure.mgmt.vmwarecloudsimple.models.StopMode + :param m: body stop mode parameter (reboot, shutdown, etc...). + :type m: ~azure.mgmt.vmwarecloudsimple.models.VirtualMachineStopMode + :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._stop_initial( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + mode=mode, + m=m, + 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_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_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}/stop'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_virtual_networks_operations.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_virtual_networks_operations.py new file mode 100644 index 000000000000..42d57ce442ef --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/operations/_virtual_networks_operations.py @@ -0,0 +1,195 @@ +# 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 VirtualNetworksOperations(object): + """VirtualNetworksOperations 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.vmwarecloudsimple.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, + region_id, # type: str + pc_name, # type: str + resource_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VirtualNetworkListResponse"] + """Implements list available virtual networks within a subscription method. + + Return list of virtual networks in location for private cloud. + + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param pc_name: The private cloud name. + :type pc_name: str + :param resource_pool_name: Resource pool used to derive vSphere cluster which contains virtual + networks. + :type resource_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualNetworkListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.vmwarecloudsimple.models.VirtualNetworkListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_id, 'str'), + 'pcName': self._serialize.url("pc_name", pc_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') + query_parameters['resourcePoolName'] = self._serialize.query("resource_pool_name", resource_pool_name, '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('VirtualNetworkListResponse', 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]: + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/virtualNetworks'} # type: ignore + + def get( + self, + region_id, # type: str + pc_name, # type: str + virtual_network_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualNetwork" + """Implements virtual network GET method. + + Return virtual network by its name. + + :param region_id: The region Id (westus, eastus). + :type region_id: str + :param pc_name: The private cloud name. + :type pc_name: str + :param virtual_network_name: virtual network id (vsphereId). + :type virtual_network_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetwork, or the result of cls(response) + :rtype: ~azure.mgmt.vmwarecloudsimple.models.VirtualNetwork + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetwork"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-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'), + 'regionId': self._serialize.url("region_id", region_id, 'str'), + 'pcName': self._serialize.url("pc_name", pc_name, 'str'), + 'virtualNetworkName': self._serialize.url("virtual_network_name", virtual_network_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) + error = self._deserialize.failsafe_deserialize(_models.CSRPError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualNetwork', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/virtualNetworks/{virtualNetworkName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/py.typed b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/sdk_packaging.toml b/sdk/compute/azure-mgmt-vmwarecloudsimple/sdk_packaging.toml new file mode 100644 index 000000000000..cfe36e89743c --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-vmwarecloudsimple" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/setup.cfg b/sdk/compute/azure-mgmt-vmwarecloudsimple/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/setup.py b/sdk/compute/azure-mgmt-vmwarecloudsimple/setup.py new file mode 100644 index 000000000000..ccb848b0559f --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/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-vmwarecloudsimple" +PACKAGE_PPRINT_NAME = "MyService 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'], + } +)