diff --git a/sdk/compute/azure-mgmt-avs/_meta.json b/sdk/compute/azure-mgmt-avs/_meta.json index 4fab822097da..c4da09ccc2fd 100644 --- a/sdk/compute/azure-mgmt-avs/_meta.json +++ b/sdk/compute/azure-mgmt-avs/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "69e98508ef71f09851b2a79971d2d8e12560adc5", + "commit": "d914d97352870b285ea38c59abd54109285acb60", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/vmware/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/vmware/resource-manager/readme.md --multiapi --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/vmware/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/__init__.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/__init__.py index 45ca0700235f..265791734e26 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/__init__.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['AVSClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_avs_client.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_avs_client.py index 26d2b7070316..ffdf7e565ce9 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_avs_client.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_avs_client.py @@ -6,39 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import AVSClientConfiguration +from .operations import AddonsOperations, AuthorizationsOperations, CloudLinksOperations, ClustersOperations, DatastoresOperations, GlobalReachConnectionsOperations, HcxEnterpriseSitesOperations, LocationsOperations, Operations, PlacementPoliciesOperations, PrivateCloudsOperations, ScriptCmdletsOperations, ScriptExecutionsOperations, ScriptPackagesOperations, VirtualMachinesOperations, WorkloadNetworksOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import AVSClientConfiguration -from .operations import Operations -from .operations import LocationsOperations -from .operations import PrivateCloudsOperations -from .operations import ClustersOperations -from .operations import DatastoresOperations -from .operations import HcxEnterpriseSitesOperations -from .operations import AuthorizationsOperations -from .operations import GlobalReachConnectionsOperations -from .operations import WorkloadNetworksOperations -from .operations import CloudLinksOperations -from .operations import AddonsOperations -from .operations import VirtualMachinesOperations -from .operations import PlacementPoliciesOperations -from .operations import ScriptPackagesOperations -from .operations import ScriptCmdletsOperations -from .operations import ScriptExecutionsOperations -from . import models - -class AVSClient(object): +class AVSClient: """Azure VMware Solution API. :ivar operations: Operations operations @@ -77,78 +60,69 @@ class AVSClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AVSClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AVSClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.locations = LocationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_clouds = PrivateCloudsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.clusters = ClustersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.datastores = DatastoresOperations( - self._client, self._config, self._serialize, self._deserialize) - self.hcx_enterprise_sites = HcxEnterpriseSitesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.authorizations = AuthorizationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.global_reach_connections = GlobalReachConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workload_networks = WorkloadNetworksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cloud_links = CloudLinksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.virtual_machines = VirtualMachinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.placement_policies = PlacementPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.script_packages = ScriptPackagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.script_cmdlets = ScriptCmdletsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.script_executions = ScriptExecutionsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_clouds = PrivateCloudsOperations(self._client, self._config, self._serialize, self._deserialize) + self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.datastores = DatastoresOperations(self._client, self._config, self._serialize, self._deserialize) + self.hcx_enterprise_sites = HcxEnterpriseSitesOperations(self._client, self._config, self._serialize, self._deserialize) + self.authorizations = AuthorizationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.global_reach_connections = GlobalReachConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.workload_networks = WorkloadNetworksOperations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_links = CloudLinksOperations(self._client, self._config, self._serialize, self._deserialize) + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machines = VirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.placement_policies = PlacementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.script_packages = ScriptPackagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.script_cmdlets = ScriptCmdletsOperations(self._client, self._config, self._serialize, self._deserialize) + self.script_executions = ScriptExecutionsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: 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. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_configuration.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_configuration.py index 89bb55be8f92..f64d5f461165 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_configuration.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +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 azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class AVSClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(AVSClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(AVSClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( 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) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_metadata.json b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_metadata.json index 06d19041cc08..6e729483aec6 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_metadata.json +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_metadata.json @@ -5,13 +5,13 @@ "name": "AVSClient", "filename": "_avs_client", "description": "Azure VMware Solution API.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AVSClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AVSClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AVSClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AVSClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "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\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_patch.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_vendor.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_version.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_version.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/__init__.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/__init__.py index 7cbca6ac278a..e3fa7a0c0f30 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/__init__.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/__init__.py @@ -8,3 +8,8 @@ from ._avs_client import AVSClient __all__ = ['AVSClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_avs_client.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_avs_client.py index 05eb5e11d5ee..68e468550adf 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_avs_client.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_avs_client.py @@ -6,37 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import AVSClientConfiguration +from .operations import AddonsOperations, AuthorizationsOperations, CloudLinksOperations, ClustersOperations, DatastoresOperations, GlobalReachConnectionsOperations, HcxEnterpriseSitesOperations, LocationsOperations, Operations, PlacementPoliciesOperations, PrivateCloudsOperations, ScriptCmdletsOperations, ScriptExecutionsOperations, ScriptPackagesOperations, VirtualMachinesOperations, WorkloadNetworksOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import AVSClientConfiguration -from .operations import Operations -from .operations import LocationsOperations -from .operations import PrivateCloudsOperations -from .operations import ClustersOperations -from .operations import DatastoresOperations -from .operations import HcxEnterpriseSitesOperations -from .operations import AuthorizationsOperations -from .operations import GlobalReachConnectionsOperations -from .operations import WorkloadNetworksOperations -from .operations import CloudLinksOperations -from .operations import AddonsOperations -from .operations import VirtualMachinesOperations -from .operations import PlacementPoliciesOperations -from .operations import ScriptPackagesOperations -from .operations import ScriptCmdletsOperations -from .operations import ScriptExecutionsOperations -from .. import models - - -class AVSClient(object): +class AVSClient: """Azure VMware Solution API. :ivar operations: Operations operations @@ -54,7 +39,8 @@ class AVSClient(object): :ivar authorizations: AuthorizationsOperations operations :vartype authorizations: azure.mgmt.avs.aio.operations.AuthorizationsOperations :ivar global_reach_connections: GlobalReachConnectionsOperations operations - :vartype global_reach_connections: azure.mgmt.avs.aio.operations.GlobalReachConnectionsOperations + :vartype global_reach_connections: + azure.mgmt.avs.aio.operations.GlobalReachConnectionsOperations :ivar workload_networks: WorkloadNetworksOperations operations :vartype workload_networks: azure.mgmt.avs.aio.operations.WorkloadNetworksOperations :ivar cloud_links: CloudLinksOperations operations @@ -75,76 +61,69 @@ class AVSClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = AVSClientConfiguration(credential, subscription_id, **kwargs) + self._config = AVSClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_clouds = PrivateCloudsOperations(self._client, self._config, self._serialize, self._deserialize) + self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.datastores = DatastoresOperations(self._client, self._config, self._serialize, self._deserialize) + self.hcx_enterprise_sites = HcxEnterpriseSitesOperations(self._client, self._config, self._serialize, self._deserialize) + self.authorizations = AuthorizationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.global_reach_connections = GlobalReachConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.workload_networks = WorkloadNetworksOperations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_links = CloudLinksOperations(self._client, self._config, self._serialize, self._deserialize) + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machines = VirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.placement_policies = PlacementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.script_packages = ScriptPackagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.script_cmdlets = ScriptCmdletsOperations(self._client, self._config, self._serialize, self._deserialize) + self.script_executions = ScriptExecutionsOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.locations = LocationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_clouds = PrivateCloudsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.clusters = ClustersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.datastores = DatastoresOperations( - self._client, self._config, self._serialize, self._deserialize) - self.hcx_enterprise_sites = HcxEnterpriseSitesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.authorizations = AuthorizationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.global_reach_connections = GlobalReachConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workload_networks = WorkloadNetworksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cloud_links = CloudLinksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.virtual_machines = VirtualMachinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.placement_policies = PlacementPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.script_packages = ScriptPackagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.script_cmdlets = ScriptCmdletsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.script_executions = ScriptExecutionsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[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. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_configuration.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_configuration.py index 7337376a2a03..c44e22460289 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(AVSClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(AVSClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( 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) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_patch.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_addons_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_addons_operations.py index e28ecff2dc74..51e76701f9d1 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_addons_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_addons_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._addons_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -67,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AddonList', pipeline_response) + deserialized = self._deserialize("AddonList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,11 +117,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -146,28 +151,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + addon_name=addon_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,8 +176,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -196,33 +193,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(addon, 'Addon') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + addon_name=addon_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(addon, 'Addon') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,8 +227,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -264,15 +254,18 @@ async def begin_create_or_update( :type addon: ~azure.mgmt.avs.models.Addon :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Addon or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Addon] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +278,21 @@ async def begin_create_or_update( private_cloud_name=private_cloud_name, addon_name=addon_name, addon=addon, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('Addon', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -318,6 +304,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}'} # type: ignore async def _delete_initial( @@ -332,28 +319,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + addon_name=addon_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -366,6 +343,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -385,15 +364,17 @@ async def begin_delete( :type addon_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +389,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -435,4 +408,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_authorizations_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_authorizations_operations.py index c4a94c95e750..e3473c077055 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_authorizations_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_authorizations_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._authorizations_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,8 +64,10 @@ def list( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExpressRouteAuthorizationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.ExpressRouteAuthorizationList] + :return: An iterator like instance of either ExpressRouteAuthorizationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.ExpressRouteAuthorizationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExpressRouteAuthorizationList"] @@ -67,36 +75,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExpressRouteAuthorizationList', pipeline_response) + deserialized = self._deserialize("ExpressRouteAuthorizationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,11 +119,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -146,28 +153,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'authorizationName': self._serialize.url("authorization_name", authorization_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + authorization_name=authorization_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,8 +178,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -196,33 +195,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'authorizationName': self._serialize.url("authorization_name", authorization_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(authorization, 'ExpressRouteAuthorization') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + authorization_name=authorization_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(authorization, 'ExpressRouteAuthorization') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,8 +229,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -264,15 +256,19 @@ async def begin_create_or_update( :type authorization: ~azure.mgmt.avs.models.ExpressRouteAuthorization :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ExpressRouteAuthorization or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExpressRouteAuthorization or the + result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ExpressRouteAuthorization"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +281,21 @@ async def begin_create_or_update( private_cloud_name=private_cloud_name, authorization_name=authorization_name, authorization=authorization, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('ExpressRouteAuthorization', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'authorizationName': self._serialize.url("authorization_name", authorization_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -318,6 +307,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}'} # type: ignore async def _delete_initial( @@ -332,28 +322,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'authorizationName': self._serialize.url("authorization_name", authorization_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + authorization_name=authorization_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -366,6 +346,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -385,15 +367,17 @@ async def begin_delete( :type authorization_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +392,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'authorizationName': self._serialize.url("authorization_name", authorization_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -435,4 +411,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_cloud_links_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_cloud_links_operations.py index 42f494bd9cbe..6b56b69b457e 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_cloud_links_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_cloud_links_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cloud_links_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -67,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CloudLinkList', pipeline_response) + deserialized = self._deserialize("CloudLinkList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,11 +117,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -146,28 +151,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'cloudLinkName': self._serialize.url("cloud_link_name", cloud_link_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cloud_link_name=cloud_link_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,8 +176,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -196,33 +193,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'cloudLinkName': self._serialize.url("cloud_link_name", cloud_link_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(cloud_link, 'CloudLink') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cloud_link_name=cloud_link_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(cloud_link, 'CloudLink') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,8 +227,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -264,15 +254,19 @@ async def begin_create_or_update( :type cloud_link: ~azure.mgmt.avs.models.CloudLink :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CloudLink or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CloudLink or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.CloudLink] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudLink"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +279,21 @@ async def begin_create_or_update( private_cloud_name=private_cloud_name, cloud_link_name=cloud_link_name, cloud_link=cloud_link, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('CloudLink', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'cloudLinkName': self._serialize.url("cloud_link_name", cloud_link_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -318,6 +305,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}'} # type: ignore async def _delete_initial( @@ -332,28 +320,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'cloudLinkName': self._serialize.url("cloud_link_name", cloud_link_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cloud_link_name=cloud_link_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -366,6 +344,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -385,15 +365,17 @@ async def begin_delete( :type cloud_link_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +390,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'cloudLinkName': self._serialize.url("cloud_link_name", cloud_link_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -435,4 +409,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_clusters_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_clusters_operations.py index 07eb94fe5269..25ab0afc6570 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_clusters_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_clusters_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -67,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterList', pipeline_response) + deserialized = self._deserialize("ClusterList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,11 +117,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -146,28 +151,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,8 +176,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -196,33 +193,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(cluster, 'Cluster') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(cluster, 'Cluster') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,8 +227,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -264,15 +254,19 @@ async def begin_create_or_update( :type cluster: ~azure.mgmt.avs.models.Cluster :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Cluster or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Cluster or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +279,21 @@ async def begin_create_or_update( private_cloud_name=private_cloud_name, cluster_name=cluster_name, cluster=cluster, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('Cluster', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -318,6 +305,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore async def _update_initial( @@ -333,33 +321,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(cluster_update, 'ClusterUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(cluster_update, 'ClusterUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -377,8 +355,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -401,15 +382,19 @@ async def begin_update( :type cluster_update: ~azure.mgmt.avs.models.ClusterUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Cluster or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Cluster or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] lro_delay = kwargs.pop( 'polling_interval', @@ -422,28 +407,21 @@ async def begin_update( private_cloud_name=private_cloud_name, cluster_name=cluster_name, cluster_update=cluster_update, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('Cluster', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -455,6 +433,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore async def _delete_initial( @@ -469,28 +448,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -503,6 +472,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -522,15 +493,17 @@ async def begin_delete( :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -545,22 +518,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -572,4 +537,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_datastores_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_datastores_operations.py index 45419a8075ca..1bfabd3d6fbe 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_datastores_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_datastores_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._datastores_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -70,37 +76,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DatastoreList', pipeline_response) + deserialized = self._deserialize("DatastoreList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,11 +122,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -153,29 +159,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'datastoreName': self._serialize.url("datastore_name", datastore_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + datastore_name=datastore_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -189,8 +185,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -205,34 +203,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'datastoreName': self._serialize.url("datastore_name", datastore_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(datastore, 'Datastore') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + datastore_name=datastore_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(datastore, 'Datastore') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -250,8 +238,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -277,15 +268,19 @@ async def begin_create_or_update( :type datastore: ~azure.mgmt.avs.models.Datastore :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Datastore or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Datastore or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Datastore] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Datastore"] lro_delay = kwargs.pop( 'polling_interval', @@ -299,29 +294,21 @@ async def begin_create_or_update( cluster_name=cluster_name, datastore_name=datastore_name, datastore=datastore, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('Datastore', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'datastoreName': self._serialize.url("datastore_name", datastore_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -333,6 +320,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}'} # type: ignore async def _delete_initial( @@ -348,29 +336,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'datastoreName': self._serialize.url("datastore_name", datastore_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + datastore_name=datastore_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -383,6 +361,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -405,15 +385,17 @@ async def begin_delete( :type datastore_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -429,23 +411,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'datastoreName': self._serialize.url("datastore_name", datastore_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -457,4 +430,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_global_reach_connections_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_global_reach_connections_operations.py index 901567d59c4a..4ed70816dfd0 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_global_reach_connections_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_global_reach_connections_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._global_reach_connections_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,8 +64,10 @@ def list( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GlobalReachConnectionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.GlobalReachConnectionList] + :return: An iterator like instance of either GlobalReachConnectionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.GlobalReachConnectionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GlobalReachConnectionList"] @@ -67,36 +75,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GlobalReachConnectionList', pipeline_response) + deserialized = self._deserialize("GlobalReachConnectionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,11 +119,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -146,28 +153,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'globalReachConnectionName': self._serialize.url("global_reach_connection_name", global_reach_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + global_reach_connection_name=global_reach_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,8 +178,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -196,33 +195,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'globalReachConnectionName': self._serialize.url("global_reach_connection_name", global_reach_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(global_reach_connection, 'GlobalReachConnection') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + global_reach_connection_name=global_reach_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(global_reach_connection, 'GlobalReachConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,8 +229,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -264,15 +256,19 @@ async def begin_create_or_update( :type global_reach_connection: ~azure.mgmt.avs.models.GlobalReachConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GlobalReachConnection or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GlobalReachConnection or the result + of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.GlobalReachConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GlobalReachConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +281,21 @@ async def begin_create_or_update( private_cloud_name=private_cloud_name, global_reach_connection_name=global_reach_connection_name, global_reach_connection=global_reach_connection, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('GlobalReachConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'globalReachConnectionName': self._serialize.url("global_reach_connection_name", global_reach_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -318,6 +307,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}'} # type: ignore async def _delete_initial( @@ -332,28 +322,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'globalReachConnectionName': self._serialize.url("global_reach_connection_name", global_reach_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + global_reach_connection_name=global_reach_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -366,6 +346,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -385,15 +367,17 @@ async def begin_delete( :type global_reach_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +392,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'globalReachConnectionName': self._serialize.url("global_reach_connection_name", global_reach_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -435,4 +411,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_hcx_enterprise_sites_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_hcx_enterprise_sites_operations.py index 3b651916242e..d0b839f3f6f2 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_hcx_enterprise_sites_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_hcx_enterprise_sites_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._hcx_enterprise_sites_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -56,7 +62,8 @@ def list( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either HcxEnterpriseSiteList or the result of cls(response) + :return: An iterator like instance of either HcxEnterpriseSiteList or the result of + cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.HcxEnterpriseSiteList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -65,36 +72,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('HcxEnterpriseSiteList', pipeline_response) + deserialized = self._deserialize("HcxEnterpriseSiteList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,11 +116,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -144,28 +150,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'hcxEnterpriseSiteName': self._serialize.url("hcx_enterprise_site_name", hcx_enterprise_site_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + hcx_enterprise_site_name=hcx_enterprise_site_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -179,8 +175,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -211,33 +210,23 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'hcxEnterpriseSiteName': self._serialize.url("hcx_enterprise_site_name", hcx_enterprise_site_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(hcx_enterprise_site, 'HcxEnterpriseSite') - # 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') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + hcx_enterprise_site_name=hcx_enterprise_site_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(hcx_enterprise_site, 'HcxEnterpriseSite') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -255,8 +244,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -284,28 +276,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'hcxEnterpriseSiteName': self._serialize.url("hcx_enterprise_site_name", hcx_enterprise_site_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + hcx_enterprise_site_name=hcx_enterprise_site_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -317,3 +299,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_locations_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_locations_operations.py index 74aba316ee8e..45626d869a6f 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_locations_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_locations_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._locations_operations import build_check_quota_availability_request, build_check_trial_availability_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_trial_availability( self, location: str, @@ -59,26 +64,16 @@ async def check_trial_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.check_trial_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_check_trial_availability_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.check_trial_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -92,8 +87,11 @@ async def check_trial_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_trial_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability'} # type: ignore + + @distributed_trace_async async def check_quota_availability( self, location: str, @@ -113,26 +111,16 @@ async def check_quota_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.check_quota_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_check_quota_availability_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.check_quota_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -146,4 +134,6 @@ async def check_quota_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_quota_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_operations.py index 40f77ebfb3e7..a7d23a97daca 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -57,30 +63,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationList', pipeline_response) + deserialized = self._deserialize("OperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +101,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_placement_policies_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_placement_policies_operations.py index aa54a3b239f0..485673c15abd 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_placement_policies_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_placement_policies_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._placement_policies_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -61,7 +67,8 @@ def list( :param cluster_name: Name of the cluster in the private cloud. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PlacementPoliciesList or the result of cls(response) + :return: An iterator like instance of either PlacementPoliciesList or the result of + cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.PlacementPoliciesList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,37 +77,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PlacementPoliciesList', pipeline_response) + deserialized = self._deserialize("PlacementPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,11 +123,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -154,29 +161,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'placementPolicyName': self._serialize.url("placement_policy_name", placement_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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + placement_policy_name=placement_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -190,8 +187,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -206,34 +205,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'placementPolicyName': self._serialize.url("placement_policy_name", placement_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(placement_policy, 'PlacementPolicy') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + placement_policy_name=placement_policy_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(placement_policy, 'PlacementPolicy') - 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 @@ -251,8 +240,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -279,15 +271,19 @@ async def begin_create_or_update( :type placement_policy: ~azure.mgmt.avs.models.PlacementPolicy :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. + :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 PlacementPolicy or the result of cls(response) + :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 PlacementPolicy or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PlacementPolicy] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PlacementPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -301,29 +297,21 @@ async def begin_create_or_update( cluster_name=cluster_name, placement_policy_name=placement_policy_name, placement_policy=placement_policy, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('PlacementPolicy', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'placementPolicyName': self._serialize.url("placement_policy_name", placement_policy_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -335,6 +323,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}'} # type: ignore async def _update_initial( @@ -351,34 +340,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'placementPolicyName': self._serialize.url("placement_policy_name", placement_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(placement_policy_update, 'PlacementPolicyUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + placement_policy_name=placement_policy_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(placement_policy_update, 'PlacementPolicyUpdate') - 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 @@ -396,8 +375,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -424,15 +406,19 @@ async def begin_update( :type placement_policy_update: ~azure.mgmt.avs.models.PlacementPolicyUpdate :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. + :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 PlacementPolicy or the result of cls(response) + :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 PlacementPolicy or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PlacementPolicy] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PlacementPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -446,29 +432,21 @@ async def begin_update( cluster_name=cluster_name, placement_policy_name=placement_policy_name, placement_policy_update=placement_policy_update, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('PlacementPolicy', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'placementPolicyName': self._serialize.url("placement_policy_name", placement_policy_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -480,6 +458,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}'} # type: ignore async def _delete_initial( @@ -495,29 +474,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'placementPolicyName': self._serialize.url("placement_policy_name", placement_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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + placement_policy_name=placement_policy_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -530,6 +499,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -553,15 +524,17 @@ async def begin_delete( :type placement_policy_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -577,23 +550,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'placementPolicyName': self._serialize.url("placement_policy_name", placement_policy_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -605,4 +569,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_private_clouds_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_private_clouds_operations.py index ba1ad880549f..575e261012a1 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_private_clouds_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_private_clouds_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_clouds_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_admin_credentials_request, build_list_in_subscription_request, build_list_request, build_rotate_nsxt_password_request_initial, build_rotate_vcenter_password_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -64,35 +70,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateCloudList', pipeline_response) + deserialized = self._deserialize("PrivateCloudList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,11 +112,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds'} # type: ignore + @distributed_trace def list_in_subscription( self, **kwargs: Any @@ -133,34 +137,29 @@ def list_in_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_in_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_in_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_in_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_in_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateCloudList', pipeline_response) + deserialized = self._deserialize("PrivateCloudList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -178,11 +177,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_in_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -207,27 +208,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -241,8 +232,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -255,32 +248,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(private_cloud, 'PrivateCloud') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_cloud, 'PrivateCloud') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -298,8 +281,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -319,15 +305,19 @@ async def begin_create_or_update( :type private_cloud: ~azure.mgmt.avs.models.PrivateCloud :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateCloud or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateCloud or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateCloud"] lro_delay = kwargs.pop( 'polling_interval', @@ -339,27 +329,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, private_cloud=private_cloud, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('PrivateCloud', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,6 +355,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}'} # type: ignore async def _update_initial( @@ -385,32 +370,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(private_cloud_update, 'PrivateCloudUpdate') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_cloud_update, 'PrivateCloudUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -428,8 +403,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -449,15 +427,19 @@ async def begin_update( :type private_cloud_update: ~azure.mgmt.avs.models.PrivateCloudUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateCloud or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateCloud or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateCloud"] lro_delay = kwargs.pop( 'polling_interval', @@ -469,27 +451,21 @@ async def begin_update( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, private_cloud_update=private_cloud_update, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('PrivateCloud', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -501,6 +477,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}'} # type: ignore async def _delete_initial( @@ -514,27 +491,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -547,6 +514,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -563,15 +532,17 @@ async def begin_delete( :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -585,21 +556,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -611,6 +575,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}'} # type: ignore async def _rotate_vcenter_password_initial( @@ -624,27 +589,17 @@ async def _rotate_vcenter_password_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._rotate_vcenter_password_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_rotate_vcenter_password_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self._rotate_vcenter_password_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -657,6 +612,8 @@ async def _rotate_vcenter_password_initial( _rotate_vcenter_password_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword'} # type: ignore + + @distributed_trace_async async def begin_rotate_vcenter_password( self, resource_group_name: str, @@ -673,15 +630,17 @@ async def begin_rotate_vcenter_password( :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -695,21 +654,14 @@ async def begin_rotate_vcenter_password( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -721,6 +673,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_rotate_vcenter_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword'} # type: ignore async def _rotate_nsxt_password_initial( @@ -734,27 +687,17 @@ async def _rotate_nsxt_password_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._rotate_nsxt_password_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_rotate_nsxt_password_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self._rotate_nsxt_password_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -767,6 +710,8 @@ async def _rotate_nsxt_password_initial( _rotate_nsxt_password_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword'} # type: ignore + + @distributed_trace_async async def begin_rotate_nsxt_password( self, resource_group_name: str, @@ -783,15 +728,17 @@ async def begin_rotate_nsxt_password( :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -805,21 +752,14 @@ async def begin_rotate_nsxt_password( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -831,8 +771,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_rotate_nsxt_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword'} # type: ignore + @distributed_trace_async async def list_admin_credentials( self, resource_group_name: str, @@ -857,27 +799,17 @@ async def list_admin_credentials( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.list_admin_credentials.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_admin_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list_admin_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -891,4 +823,6 @@ async def list_admin_credentials( return cls(pipeline_response, deserialized, {}) return deserialized + list_admin_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/listAdminCredentials'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_cmdlets_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_cmdlets_operations.py index 77dd7139bf2b..44b36d890bed 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_cmdlets_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_cmdlets_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._script_cmdlets_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -67,37 +73,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'scriptPackageName': self._serialize.url("script_package_name", script_package_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + script_package_name=script_package_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + script_package_name=script_package_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ScriptCmdletsList', pipeline_response) + deserialized = self._deserialize("ScriptCmdletsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,11 +119,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -149,29 +155,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'scriptPackageName': self._serialize.url("script_package_name", script_package_name, 'str'), - 'scriptCmdletName': self._serialize.url("script_cmdlet_name", script_cmdlet_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + script_package_name=script_package_name, + script_cmdlet_name=script_cmdlet_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -185,4 +181,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets/{scriptCmdletName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_executions_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_executions_operations.py index 1b309004b286..48abf2324f16 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_executions_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_executions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._script_executions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_execution_logs_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,7 +64,8 @@ def list( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ScriptExecutionsList or the result of cls(response) + :return: An iterator like instance of either ScriptExecutionsList or the result of + cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.ScriptExecutionsList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -67,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ScriptExecutionsList', pipeline_response) + deserialized = self._deserialize("ScriptExecutionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,11 +118,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -146,28 +152,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + script_execution_name=script_execution_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,8 +177,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -196,33 +194,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(script_execution, 'ScriptExecution') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + script_execution_name=script_execution_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(script_execution, 'ScriptExecution') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,8 +228,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -264,15 +255,19 @@ async def begin_create_or_update( :type script_execution: ~azure.mgmt.avs.models.ScriptExecution :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ScriptExecution or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ScriptExecution or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ScriptExecution] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptExecution"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +280,21 @@ async def begin_create_or_update( private_cloud_name=private_cloud_name, script_execution_name=script_execution_name, script_execution=script_execution, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('ScriptExecution', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -318,6 +306,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}'} # type: ignore async def _delete_initial( @@ -332,28 +321,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + script_execution_name=script_execution_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -366,6 +345,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -385,15 +366,17 @@ async def begin_delete( :type script_execution_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +391,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -435,8 +410,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}'} # type: ignore + @distributed_trace_async async def get_execution_logs( self, resource_group_name: str, @@ -466,36 +443,26 @@ async def get_execution_logs( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.get_execution_logs.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if script_output_stream_type is not None: - body_content = self._serialize.body(script_output_stream_type, '[str]') + _json = self._serialize.body(script_output_stream_type, '[str]') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_get_execution_logs_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + script_execution_name=script_execution_name, + content_type=content_type, + json=_json, + template_url=self.get_execution_logs.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -509,4 +476,6 @@ async def get_execution_logs( return cls(pipeline_response, deserialized, {}) return deserialized + get_execution_logs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}/getExecutionLogs'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_packages_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_packages_operations.py index 375eeb676519..2ab3010b5faf 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_packages_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_packages_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._script_packages_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -63,36 +69,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ScriptPackagesList', pipeline_response) + deserialized = self._deserialize("ScriptPackagesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,11 +113,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -140,28 +145,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'scriptPackageName': self._serialize.url("script_package_name", script_package_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + script_package_name=script_package_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -175,4 +170,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_virtual_machines_operations.py index f61947d9bef8..25e8a3031e73 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_virtual_machines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._virtual_machines_operations import build_get_request, build_list_request, build_restrict_movement_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -70,37 +76,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachinesList', pipeline_response) + deserialized = self._deserialize("VirtualMachinesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,11 +122,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -153,29 +159,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'virtualMachineId': self._serialize.url("virtual_machine_id", virtual_machine_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + virtual_machine_id=virtual_machine_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -189,8 +185,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}'} # type: ignore + async def _restrict_movement_initial( self, resource_group_name: str, @@ -205,34 +203,24 @@ async def _restrict_movement_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._restrict_movement_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'virtualMachineId': self._serialize.url("virtual_machine_id", virtual_machine_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(restrict_movement, 'VirtualMachineRestrictMovement') + + request = build_restrict_movement_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + virtual_machine_id=virtual_machine_id, + content_type=content_type, + json=_json, + template_url=self._restrict_movement_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(restrict_movement, 'VirtualMachineRestrictMovement') - 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 @@ -245,6 +233,8 @@ async def _restrict_movement_initial( _restrict_movement_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement'} # type: ignore + + @distributed_trace_async async def begin_restrict_movement( self, resource_group_name: str, @@ -271,15 +261,18 @@ async def begin_restrict_movement( :type restrict_movement: ~azure.mgmt.avs.models.VirtualMachineRestrictMovement :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -293,26 +286,18 @@ async def begin_restrict_movement( cluster_name=cluster_name, virtual_machine_id=virtual_machine_id, restrict_movement=restrict_movement, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'virtualMachineId': self._serialize.url("virtual_machine_id", virtual_machine_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -324,4 +309,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restrict_movement.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_workload_networks_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_workload_networks_operations.py index 82b59135d38c..a3d66b95b5a0 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_workload_networks_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_workload_networks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._workload_networks_operations import build_create_dhcp_request_initial, build_create_dns_service_request_initial, build_create_dns_zone_request_initial, build_create_port_mirroring_request_initial, build_create_public_ip_request_initial, build_create_segments_request_initial, build_create_vm_group_request_initial, build_delete_dhcp_request_initial, build_delete_dns_service_request_initial, build_delete_dns_zone_request_initial, build_delete_port_mirroring_request_initial, build_delete_public_ip_request_initial, build_delete_segment_request_initial, build_delete_vm_group_request_initial, build_get_dhcp_request, build_get_dns_service_request, build_get_dns_zone_request, build_get_gateway_request, build_get_port_mirroring_request, build_get_public_ip_request, build_get_segment_request, build_get_virtual_machine_request, build_get_vm_group_request, build_list_dhcp_request, build_list_dns_services_request, build_list_dns_zones_request, build_list_gateways_request, build_list_port_mirroring_request, build_list_public_i_ps_request, build_list_segments_request, build_list_virtual_machines_request, build_list_vm_groups_request, build_update_dhcp_request_initial, build_update_dns_service_request_initial, build_update_dns_zone_request_initial, build_update_port_mirroring_request_initial, build_update_segments_request_initial, build_update_vm_group_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_segments( self, resource_group_name: str, @@ -58,8 +64,10 @@ def list_segments( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkSegmentsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkSegmentsList] + :return: An iterator like instance of either WorkloadNetworkSegmentsList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkSegmentsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkSegmentsList"] @@ -67,36 +75,33 @@ def list_segments( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_segments.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_segments_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list_segments.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_segments_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadNetworkSegmentsList', pipeline_response) + deserialized = self._deserialize("WorkloadNetworkSegmentsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,11 +119,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_segments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments'} # type: ignore + @distributed_trace_async async def get_segment( self, resource_group_name: str, @@ -146,28 +153,18 @@ async def get_segment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_segment.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'segmentId': self._serialize.url("segment_id", segment_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_segment_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + segment_id=segment_id, + template_url=self.get_segment.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,8 +178,10 @@ async def get_segment( return cls(pipeline_response, deserialized, {}) return deserialized + get_segment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + async def _create_segments_initial( self, resource_group_name: str, @@ -196,33 +195,23 @@ async def _create_segments_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_segments_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'segmentId': self._serialize.url("segment_id", segment_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(workload_network_segment, 'WorkloadNetworkSegment') + + request = build_create_segments_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + segment_id=segment_id, + content_type=content_type, + json=_json, + template_url=self._create_segments_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_segment, 'WorkloadNetworkSegment') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,8 +229,11 @@ async def _create_segments_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_segments_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + + @distributed_trace_async async def begin_create_segments( self, resource_group_name: str, @@ -264,15 +256,19 @@ async def begin_create_segments( :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result + of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkSegment"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +281,21 @@ async def begin_create_segments( private_cloud_name=private_cloud_name, segment_id=segment_id, workload_network_segment=workload_network_segment, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkSegment', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'segmentId': self._serialize.url("segment_id", segment_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -318,6 +307,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_segments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore async def _update_segments_initial( @@ -333,33 +323,23 @@ async def _update_segments_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_segments_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'segmentId': self._serialize.url("segment_id", segment_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(workload_network_segment, 'WorkloadNetworkSegment') + + request = build_update_segments_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + segment_id=segment_id, + content_type=content_type, + json=_json, + template_url=self._update_segments_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_segment, 'WorkloadNetworkSegment') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -375,8 +355,11 @@ async def _update_segments_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_segments_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + + @distributed_trace_async async def begin_update_segments( self, resource_group_name: str, @@ -399,15 +382,19 @@ async def begin_update_segments( :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result + of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkSegment"] lro_delay = kwargs.pop( 'polling_interval', @@ -420,28 +407,21 @@ async def begin_update_segments( private_cloud_name=private_cloud_name, segment_id=segment_id, workload_network_segment=workload_network_segment, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkSegment', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'segmentId': self._serialize.url("segment_id", segment_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -453,6 +433,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_segments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore async def _delete_segment_initial( @@ -467,28 +448,18 @@ async def _delete_segment_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_segment_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'segmentId': self._serialize.url("segment_id", segment_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_segment_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + segment_id=segment_id, + template_url=self._delete_segment_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -501,6 +472,8 @@ async def _delete_segment_initial( _delete_segment_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + + @distributed_trace_async async def begin_delete_segment( self, resource_group_name: str, @@ -520,15 +493,17 @@ async def begin_delete_segment( :type segment_id: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -543,22 +518,14 @@ async def begin_delete_segment( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'segmentId': self._serialize.url("segment_id", segment_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -570,8 +537,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_segment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + @distributed_trace def list_dhcp( self, resource_group_name: str, @@ -587,7 +556,8 @@ def list_dhcp( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkDhcpList or the result of cls(response) + :return: An iterator like instance of either WorkloadNetworkDhcpList or the result of + cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDhcpList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -596,36 +566,33 @@ def list_dhcp( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_dhcp.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_dhcp_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list_dhcp.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_dhcp_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadNetworkDhcpList', pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDhcpList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -643,11 +610,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_dhcp.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations'} # type: ignore + @distributed_trace_async async def get_dhcp( self, resource_group_name: str, @@ -675,28 +644,18 @@ async def get_dhcp( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_dhcp.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'dhcpId': self._serialize.url("dhcp_id", dhcp_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_dhcp_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + dhcp_id=dhcp_id, + private_cloud_name=private_cloud_name, + template_url=self.get_dhcp.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -710,8 +669,10 @@ async def get_dhcp( return cls(pipeline_response, deserialized, {}) return deserialized + get_dhcp.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + async def _create_dhcp_initial( self, resource_group_name: str, @@ -725,33 +686,23 @@ async def _create_dhcp_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_dhcp_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dhcpId': self._serialize.url("dhcp_id", dhcp_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(workload_network_dhcp, 'WorkloadNetworkDhcp') + + request = build_create_dhcp_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dhcp_id=dhcp_id, + content_type=content_type, + json=_json, + template_url=self._create_dhcp_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_dhcp, 'WorkloadNetworkDhcp') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -769,8 +720,11 @@ async def _create_dhcp_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_dhcp_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + + @distributed_trace_async async def begin_create_dhcp( self, resource_group_name: str, @@ -793,15 +747,19 @@ async def begin_create_dhcp( :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDhcp"] lro_delay = kwargs.pop( 'polling_interval', @@ -814,28 +772,21 @@ async def begin_create_dhcp( private_cloud_name=private_cloud_name, dhcp_id=dhcp_id, workload_network_dhcp=workload_network_dhcp, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkDhcp', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dhcpId': self._serialize.url("dhcp_id", dhcp_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -847,6 +798,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_dhcp.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore async def _update_dhcp_initial( @@ -862,33 +814,23 @@ async def _update_dhcp_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_dhcp_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dhcpId': self._serialize.url("dhcp_id", dhcp_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(workload_network_dhcp, 'WorkloadNetworkDhcp') + + request = build_update_dhcp_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dhcp_id=dhcp_id, + content_type=content_type, + json=_json, + template_url=self._update_dhcp_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_dhcp, 'WorkloadNetworkDhcp') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -904,8 +846,11 @@ async def _update_dhcp_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_dhcp_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + + @distributed_trace_async async def begin_update_dhcp( self, resource_group_name: str, @@ -928,15 +873,19 @@ async def begin_update_dhcp( :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDhcp"] lro_delay = kwargs.pop( 'polling_interval', @@ -949,28 +898,21 @@ async def begin_update_dhcp( private_cloud_name=private_cloud_name, dhcp_id=dhcp_id, workload_network_dhcp=workload_network_dhcp, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkDhcp', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dhcpId': self._serialize.url("dhcp_id", dhcp_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -982,6 +924,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_dhcp.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore async def _delete_dhcp_initial( @@ -996,28 +939,18 @@ async def _delete_dhcp_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_dhcp_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dhcpId': self._serialize.url("dhcp_id", dhcp_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_dhcp_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dhcp_id=dhcp_id, + template_url=self._delete_dhcp_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1030,6 +963,8 @@ async def _delete_dhcp_initial( _delete_dhcp_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + + @distributed_trace_async async def begin_delete_dhcp( self, resource_group_name: str, @@ -1049,15 +984,17 @@ async def begin_delete_dhcp( :type dhcp_id: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1072,22 +1009,14 @@ async def begin_delete_dhcp( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dhcpId': self._serialize.url("dhcp_id", dhcp_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1099,8 +1028,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_dhcp.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + @distributed_trace def list_gateways( self, resource_group_name: str, @@ -1116,8 +1047,10 @@ def list_gateways( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkGatewayList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkGatewayList] + :return: An iterator like instance of either WorkloadNetworkGatewayList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkGatewayList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkGatewayList"] @@ -1125,36 +1058,33 @@ def list_gateways( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_gateways.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_gateways_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list_gateways.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_gateways_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadNetworkGatewayList', pipeline_response) + deserialized = self._deserialize("WorkloadNetworkGatewayList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1172,11 +1102,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_gateways.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways'} # type: ignore + @distributed_trace_async async def get_gateway( self, resource_group_name: str, @@ -1204,28 +1136,18 @@ async def get_gateway( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_gateway.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_gateway_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + gateway_id=gateway_id, + template_url=self.get_gateway.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1239,8 +1161,11 @@ async def get_gateway( return cls(pipeline_response, deserialized, {}) return deserialized + get_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId}'} # type: ignore + + @distributed_trace def list_port_mirroring( self, resource_group_name: str, @@ -1256,8 +1181,10 @@ def list_port_mirroring( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkPortMirroringList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPortMirroringList] + :return: An iterator like instance of either WorkloadNetworkPortMirroringList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPortMirroringList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPortMirroringList"] @@ -1265,36 +1192,33 @@ def list_port_mirroring( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_port_mirroring.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_port_mirroring_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list_port_mirroring.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_port_mirroring_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadNetworkPortMirroringList', pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPortMirroringList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1312,11 +1236,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_port_mirroring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles'} # type: ignore + @distributed_trace_async async def get_port_mirroring( self, resource_group_name: str, @@ -1345,28 +1271,18 @@ async def get_port_mirroring( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_port_mirroring.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_port_mirroring_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + port_mirroring_id=port_mirroring_id, + template_url=self.get_port_mirroring.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1380,8 +1296,10 @@ async def get_port_mirroring( return cls(pipeline_response, deserialized, {}) return deserialized + get_port_mirroring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + async def _create_port_mirroring_initial( self, resource_group_name: str, @@ -1395,33 +1313,23 @@ async def _create_port_mirroring_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_port_mirroring_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(workload_network_port_mirroring, 'WorkloadNetworkPortMirroring') + + request = build_create_port_mirroring_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + port_mirroring_id=port_mirroring_id, + content_type=content_type, + json=_json, + template_url=self._create_port_mirroring_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_port_mirroring, 'WorkloadNetworkPortMirroring') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1439,8 +1347,11 @@ async def _create_port_mirroring_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_port_mirroring_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + + @distributed_trace_async async def begin_create_port_mirroring( self, resource_group_name: str, @@ -1464,15 +1375,19 @@ async def begin_create_port_mirroring( :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the + result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPortMirroring"] lro_delay = kwargs.pop( 'polling_interval', @@ -1485,28 +1400,21 @@ async def begin_create_port_mirroring( private_cloud_name=private_cloud_name, port_mirroring_id=port_mirroring_id, workload_network_port_mirroring=workload_network_port_mirroring, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkPortMirroring', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1518,6 +1426,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_port_mirroring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore async def _update_port_mirroring_initial( @@ -1533,33 +1442,23 @@ async def _update_port_mirroring_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_port_mirroring_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(workload_network_port_mirroring, 'WorkloadNetworkPortMirroring') + + request = build_update_port_mirroring_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + port_mirroring_id=port_mirroring_id, + content_type=content_type, + json=_json, + template_url=self._update_port_mirroring_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_port_mirroring, 'WorkloadNetworkPortMirroring') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1575,8 +1474,11 @@ async def _update_port_mirroring_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_port_mirroring_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + + @distributed_trace_async async def begin_update_port_mirroring( self, resource_group_name: str, @@ -1600,15 +1502,19 @@ async def begin_update_port_mirroring( :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the + result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPortMirroring"] lro_delay = kwargs.pop( 'polling_interval', @@ -1621,28 +1527,21 @@ async def begin_update_port_mirroring( private_cloud_name=private_cloud_name, port_mirroring_id=port_mirroring_id, workload_network_port_mirroring=workload_network_port_mirroring, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkPortMirroring', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1654,6 +1553,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_port_mirroring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore async def _delete_port_mirroring_initial( @@ -1668,28 +1568,18 @@ async def _delete_port_mirroring_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_port_mirroring_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_port_mirroring_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + port_mirroring_id=port_mirroring_id, + private_cloud_name=private_cloud_name, + template_url=self._delete_port_mirroring_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1702,6 +1592,8 @@ async def _delete_port_mirroring_initial( _delete_port_mirroring_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + + @distributed_trace_async async def begin_delete_port_mirroring( self, resource_group_name: str, @@ -1722,15 +1614,17 @@ async def begin_delete_port_mirroring( :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1745,22 +1639,14 @@ async def begin_delete_port_mirroring( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1772,8 +1658,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_port_mirroring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + @distributed_trace def list_vm_groups( self, resource_group_name: str, @@ -1789,8 +1677,10 @@ def list_vm_groups( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkVMGroupsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVMGroupsList] + :return: An iterator like instance of either WorkloadNetworkVMGroupsList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVMGroupsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVMGroupsList"] @@ -1798,36 +1688,33 @@ def list_vm_groups( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_vm_groups.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_vm_groups_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list_vm_groups.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_vm_groups_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadNetworkVMGroupsList', pipeline_response) + deserialized = self._deserialize("WorkloadNetworkVMGroupsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1845,11 +1732,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_vm_groups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups'} # type: ignore + @distributed_trace_async async def get_vm_group( self, resource_group_name: str, @@ -1877,28 +1766,18 @@ async def get_vm_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_vm_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'vmGroupId': self._serialize.url("vm_group_id", vm_group_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_vm_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + vm_group_id=vm_group_id, + template_url=self.get_vm_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1912,8 +1791,10 @@ async def get_vm_group( return cls(pipeline_response, deserialized, {}) return deserialized + get_vm_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + async def _create_vm_group_initial( self, resource_group_name: str, @@ -1927,33 +1808,23 @@ async def _create_vm_group_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_vm_group_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'vmGroupId': self._serialize.url("vm_group_id", vm_group_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(workload_network_vm_group, 'WorkloadNetworkVMGroup') + + request = build_create_vm_group_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + vm_group_id=vm_group_id, + content_type=content_type, + json=_json, + template_url=self._create_vm_group_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_vm_group, 'WorkloadNetworkVMGroup') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1971,8 +1842,11 @@ async def _create_vm_group_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_vm_group_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + + @distributed_trace_async async def begin_create_vm_group( self, resource_group_name: str, @@ -1995,15 +1869,19 @@ async def begin_create_vm_group( :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result + of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVMGroup"] lro_delay = kwargs.pop( 'polling_interval', @@ -2016,28 +1894,21 @@ async def begin_create_vm_group( private_cloud_name=private_cloud_name, vm_group_id=vm_group_id, workload_network_vm_group=workload_network_vm_group, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkVMGroup', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'vmGroupId': self._serialize.url("vm_group_id", vm_group_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2049,6 +1920,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_vm_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore async def _update_vm_group_initial( @@ -2064,33 +1936,23 @@ async def _update_vm_group_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_vm_group_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'vmGroupId': self._serialize.url("vm_group_id", vm_group_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(workload_network_vm_group, 'WorkloadNetworkVMGroup') + + request = build_update_vm_group_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + vm_group_id=vm_group_id, + content_type=content_type, + json=_json, + template_url=self._update_vm_group_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_vm_group, 'WorkloadNetworkVMGroup') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2106,8 +1968,11 @@ async def _update_vm_group_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_vm_group_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + + @distributed_trace_async async def begin_update_vm_group( self, resource_group_name: str, @@ -2130,15 +1995,19 @@ async def begin_update_vm_group( :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result + of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVMGroup"] lro_delay = kwargs.pop( 'polling_interval', @@ -2151,28 +2020,21 @@ async def begin_update_vm_group( private_cloud_name=private_cloud_name, vm_group_id=vm_group_id, workload_network_vm_group=workload_network_vm_group, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkVMGroup', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'vmGroupId': self._serialize.url("vm_group_id", vm_group_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2184,6 +2046,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_vm_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore async def _delete_vm_group_initial( @@ -2198,28 +2061,18 @@ async def _delete_vm_group_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_vm_group_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'vmGroupId': self._serialize.url("vm_group_id", vm_group_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_vm_group_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vm_group_id=vm_group_id, + private_cloud_name=private_cloud_name, + template_url=self._delete_vm_group_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2232,6 +2085,8 @@ async def _delete_vm_group_initial( _delete_vm_group_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + + @distributed_trace_async async def begin_delete_vm_group( self, resource_group_name: str, @@ -2251,15 +2106,17 @@ async def begin_delete_vm_group( :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2274,22 +2131,14 @@ async def begin_delete_vm_group( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'vmGroupId': self._serialize.url("vm_group_id", vm_group_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2301,8 +2150,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_vm_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + @distributed_trace def list_virtual_machines( self, resource_group_name: str, @@ -2318,8 +2169,10 @@ def list_virtual_machines( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkVirtualMachinesList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVirtualMachinesList] + :return: An iterator like instance of either WorkloadNetworkVirtualMachinesList or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVirtualMachinesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVirtualMachinesList"] @@ -2327,36 +2180,33 @@ def list_virtual_machines( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_virtual_machines.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_virtual_machines_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list_virtual_machines.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_virtual_machines_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadNetworkVirtualMachinesList', pipeline_response) + deserialized = self._deserialize("WorkloadNetworkVirtualMachinesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -2374,11 +2224,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_virtual_machines.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines'} # type: ignore + @distributed_trace_async async def get_virtual_machine( self, resource_group_name: str, @@ -2406,28 +2258,18 @@ async def get_virtual_machine( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_virtual_machine.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'virtualMachineId': self._serialize.url("virtual_machine_id", virtual_machine_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_virtual_machine_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + virtual_machine_id=virtual_machine_id, + template_url=self.get_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2441,8 +2283,11 @@ async def get_virtual_machine( return cls(pipeline_response, deserialized, {}) return deserialized + get_virtual_machine.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId}'} # type: ignore + + @distributed_trace def list_dns_services( self, resource_group_name: str, @@ -2458,8 +2303,10 @@ def list_dns_services( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkDnsServicesList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsServicesList] + :return: An iterator like instance of either WorkloadNetworkDnsServicesList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsServicesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsServicesList"] @@ -2467,36 +2314,33 @@ def list_dns_services( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_dns_services.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_dns_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list_dns_services.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_dns_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadNetworkDnsServicesList', pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsServicesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -2514,11 +2358,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_dns_services.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices'} # type: ignore + @distributed_trace_async async def get_dns_service( self, resource_group_name: str, @@ -2547,28 +2393,18 @@ async def get_dns_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_dns_service.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_dns_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_service_id=dns_service_id, + template_url=self.get_dns_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2582,8 +2418,10 @@ async def get_dns_service( return cls(pipeline_response, deserialized, {}) return deserialized + get_dns_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + async def _create_dns_service_initial( self, resource_group_name: str, @@ -2597,33 +2435,23 @@ async def _create_dns_service_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_dns_service_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(workload_network_dns_service, 'WorkloadNetworkDnsService') + + request = build_create_dns_service_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_service_id=dns_service_id, + content_type=content_type, + json=_json, + template_url=self._create_dns_service_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_dns_service, 'WorkloadNetworkDnsService') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2641,8 +2469,11 @@ async def _create_dns_service_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_dns_service_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + + @distributed_trace_async async def begin_create_dns_service( self, resource_group_name: str, @@ -2666,15 +2497,19 @@ async def begin_create_dns_service( :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the + result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsService"] lro_delay = kwargs.pop( 'polling_interval', @@ -2687,28 +2522,21 @@ async def begin_create_dns_service( private_cloud_name=private_cloud_name, dns_service_id=dns_service_id, workload_network_dns_service=workload_network_dns_service, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkDnsService', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2720,6 +2548,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_dns_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore async def _update_dns_service_initial( @@ -2735,33 +2564,23 @@ async def _update_dns_service_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_dns_service_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(workload_network_dns_service, 'WorkloadNetworkDnsService') + + request = build_update_dns_service_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_service_id=dns_service_id, + content_type=content_type, + json=_json, + template_url=self._update_dns_service_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_dns_service, 'WorkloadNetworkDnsService') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2777,8 +2596,11 @@ async def _update_dns_service_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_dns_service_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + + @distributed_trace_async async def begin_update_dns_service( self, resource_group_name: str, @@ -2802,15 +2624,19 @@ async def begin_update_dns_service( :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the + result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsService"] lro_delay = kwargs.pop( 'polling_interval', @@ -2823,28 +2649,21 @@ async def begin_update_dns_service( private_cloud_name=private_cloud_name, dns_service_id=dns_service_id, workload_network_dns_service=workload_network_dns_service, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkDnsService', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2856,6 +2675,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_dns_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore async def _delete_dns_service_initial( @@ -2870,28 +2690,18 @@ async def _delete_dns_service_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_dns_service_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_dns_service_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + dns_service_id=dns_service_id, + private_cloud_name=private_cloud_name, + template_url=self._delete_dns_service_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -2904,6 +2714,8 @@ async def _delete_dns_service_initial( _delete_dns_service_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + + @distributed_trace_async async def begin_delete_dns_service( self, resource_group_name: str, @@ -2924,15 +2736,17 @@ async def begin_delete_dns_service( :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2947,22 +2761,14 @@ async def begin_delete_dns_service( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2974,8 +2780,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_dns_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + @distributed_trace def list_dns_zones( self, resource_group_name: str, @@ -2991,8 +2799,10 @@ def list_dns_zones( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkDnsZonesList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsZonesList] + :return: An iterator like instance of either WorkloadNetworkDnsZonesList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsZonesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsZonesList"] @@ -3000,36 +2810,33 @@ def list_dns_zones( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_dns_zones.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_dns_zones_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list_dns_zones.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_dns_zones_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadNetworkDnsZonesList', pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsZonesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -3047,11 +2854,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_dns_zones.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones'} # type: ignore + @distributed_trace_async async def get_dns_zone( self, resource_group_name: str, @@ -3079,28 +2888,18 @@ async def get_dns_zone( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_dns_zone.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_dns_zone_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_zone_id=dns_zone_id, + template_url=self.get_dns_zone.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -3114,8 +2913,10 @@ async def get_dns_zone( return cls(pipeline_response, deserialized, {}) return deserialized + get_dns_zone.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + async def _create_dns_zone_initial( self, resource_group_name: str, @@ -3129,33 +2930,23 @@ async def _create_dns_zone_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_dns_zone_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(workload_network_dns_zone, 'WorkloadNetworkDnsZone') + + request = build_create_dns_zone_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_zone_id=dns_zone_id, + content_type=content_type, + json=_json, + template_url=self._create_dns_zone_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_dns_zone, 'WorkloadNetworkDnsZone') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3173,8 +2964,11 @@ async def _create_dns_zone_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_dns_zone_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + + @distributed_trace_async async def begin_create_dns_zone( self, resource_group_name: str, @@ -3197,15 +2991,19 @@ async def begin_create_dns_zone( :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result + of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsZone"] lro_delay = kwargs.pop( 'polling_interval', @@ -3218,28 +3016,21 @@ async def begin_create_dns_zone( private_cloud_name=private_cloud_name, dns_zone_id=dns_zone_id, workload_network_dns_zone=workload_network_dns_zone, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkDnsZone', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -3251,6 +3042,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_dns_zone.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore async def _update_dns_zone_initial( @@ -3266,33 +3058,23 @@ async def _update_dns_zone_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_dns_zone_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(workload_network_dns_zone, 'WorkloadNetworkDnsZone') - # 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') + request = build_update_dns_zone_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_zone_id=dns_zone_id, + content_type=content_type, + json=_json, + template_url=self._update_dns_zone_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_dns_zone, 'WorkloadNetworkDnsZone') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3308,8 +3090,11 @@ async def _update_dns_zone_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_dns_zone_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + + @distributed_trace_async async def begin_update_dns_zone( self, resource_group_name: str, @@ -3332,15 +3117,19 @@ async def begin_update_dns_zone( :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result + of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsZone"] lro_delay = kwargs.pop( 'polling_interval', @@ -3353,28 +3142,21 @@ async def begin_update_dns_zone( private_cloud_name=private_cloud_name, dns_zone_id=dns_zone_id, workload_network_dns_zone=workload_network_dns_zone, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkDnsZone', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -3386,6 +3168,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_dns_zone.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore async def _delete_dns_zone_initial( @@ -3400,28 +3183,18 @@ async def _delete_dns_zone_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_dns_zone_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_dns_zone_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + dns_zone_id=dns_zone_id, + private_cloud_name=private_cloud_name, + template_url=self._delete_dns_zone_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -3434,6 +3207,8 @@ async def _delete_dns_zone_initial( _delete_dns_zone_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + + @distributed_trace_async async def begin_delete_dns_zone( self, resource_group_name: str, @@ -3453,15 +3228,17 @@ async def begin_delete_dns_zone( :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -3476,22 +3253,14 @@ async def begin_delete_dns_zone( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -3503,8 +3272,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_dns_zone.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + @distributed_trace def list_public_i_ps( self, resource_group_name: str, @@ -3520,8 +3291,10 @@ def list_public_i_ps( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkPublicIPsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPublicIPsList] + :return: An iterator like instance of either WorkloadNetworkPublicIPsList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPublicIPsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPublicIPsList"] @@ -3529,36 +3302,33 @@ def list_public_i_ps( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_public_i_ps.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_public_i_ps_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list_public_i_ps.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_public_i_ps_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadNetworkPublicIPsList', pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPublicIPsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -3576,11 +3346,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_public_i_ps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs'} # type: ignore + @distributed_trace_async async def get_public_ip( self, resource_group_name: str, @@ -3609,28 +3381,18 @@ async def get_public_ip( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_public_ip.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'publicIPId': self._serialize.url("public_ip_id", public_ip_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_public_ip_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + public_ip_id=public_ip_id, + template_url=self.get_public_ip.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -3644,8 +3406,10 @@ async def get_public_ip( return cls(pipeline_response, deserialized, {}) return deserialized + get_public_ip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}'} # type: ignore + async def _create_public_ip_initial( self, resource_group_name: str, @@ -3659,33 +3423,23 @@ async def _create_public_ip_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_public_ip_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'publicIPId': self._serialize.url("public_ip_id", public_ip_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(workload_network_public_ip, 'WorkloadNetworkPublicIP') + + request = build_create_public_ip_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + public_ip_id=public_ip_id, + content_type=content_type, + json=_json, + template_url=self._create_public_ip_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_public_ip, 'WorkloadNetworkPublicIP') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3703,8 +3457,11 @@ async def _create_public_ip_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_public_ip_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}'} # type: ignore + + @distributed_trace_async async def begin_create_public_ip( self, resource_group_name: str, @@ -3728,15 +3485,19 @@ async def begin_create_public_ip( :type workload_network_public_ip: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WorkloadNetworkPublicIP or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkPublicIP or the + result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPublicIP"] lro_delay = kwargs.pop( 'polling_interval', @@ -3749,28 +3510,21 @@ async def begin_create_public_ip( private_cloud_name=private_cloud_name, public_ip_id=public_ip_id, workload_network_public_ip=workload_network_public_ip, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkPublicIP', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'publicIPId': self._serialize.url("public_ip_id", public_ip_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -3782,6 +3536,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_public_ip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}'} # type: ignore async def _delete_public_ip_initial( @@ -3796,28 +3551,18 @@ async def _delete_public_ip_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_public_ip_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'publicIPId': self._serialize.url("public_ip_id", public_ip_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_public_ip_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + public_ip_id=public_ip_id, + private_cloud_name=private_cloud_name, + template_url=self._delete_public_ip_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -3830,6 +3575,8 @@ async def _delete_public_ip_initial( _delete_public_ip_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}'} # type: ignore + + @distributed_trace_async async def begin_delete_public_ip( self, resource_group_name: str, @@ -3850,15 +3597,17 @@ async def begin_delete_public_ip( :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -3873,22 +3622,14 @@ async def begin_delete_public_ip( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'publicIPId': self._serialize.url("public_ip_id", public_ip_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -3900,4 +3641,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_public_ip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/__init__.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/__init__.py index 7ec2a63b7e5b..4a7154a88af0 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/__init__.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/__init__.py @@ -6,200 +6,103 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import Addon - from ._models_py3 import AddonHcxProperties - from ._models_py3 import AddonList - from ._models_py3 import AddonProperties - from ._models_py3 import AddonSrmProperties - from ._models_py3 import AddonVrProperties - from ._models_py3 import AdminCredentials - from ._models_py3 import AvailabilityProperties - from ._models_py3 import Circuit - from ._models_py3 import CloudLink - from ._models_py3 import CloudLinkList - from ._models_py3 import Cluster - from ._models_py3 import ClusterList - from ._models_py3 import ClusterProperties - from ._models_py3 import ClusterUpdate - from ._models_py3 import CommonClusterProperties - from ._models_py3 import Datastore - from ._models_py3 import DatastoreList - from ._models_py3 import DiskPoolVolume - from ._models_py3 import Encryption - from ._models_py3 import EncryptionKeyVaultProperties - from ._models_py3 import Endpoints - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorResponse - from ._models_py3 import ExpressRouteAuthorization - from ._models_py3 import ExpressRouteAuthorizationList - from ._models_py3 import GlobalReachConnection - from ._models_py3 import GlobalReachConnectionList - from ._models_py3 import HcxEnterpriseSite - from ._models_py3 import HcxEnterpriseSiteList - from ._models_py3 import IdentitySource - from ._models_py3 import LogSpecification - from ._models_py3 import ManagementCluster - from ._models_py3 import MetricDimension - from ._models_py3 import MetricSpecification - from ._models_py3 import NetAppVolume - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationList - from ._models_py3 import OperationProperties - from ._models_py3 import PSCredentialExecutionParameter - from ._models_py3 import PlacementPoliciesList - from ._models_py3 import PlacementPolicy - from ._models_py3 import PlacementPolicyProperties - from ._models_py3 import PlacementPolicyUpdate - from ._models_py3 import PrivateCloud - from ._models_py3 import PrivateCloudIdentity - from ._models_py3 import PrivateCloudList - from ._models_py3 import PrivateCloudProperties - from ._models_py3 import PrivateCloudUpdate - from ._models_py3 import PrivateCloudUpdateProperties - from ._models_py3 import ProxyResource - from ._models_py3 import Quota - from ._models_py3 import Resource - from ._models_py3 import ScriptCmdlet - from ._models_py3 import ScriptCmdletsList - from ._models_py3 import ScriptExecution - from ._models_py3 import ScriptExecutionParameter - from ._models_py3 import ScriptExecutionsList - from ._models_py3 import ScriptPackage - from ._models_py3 import ScriptPackagesList - from ._models_py3 import ScriptParameter - from ._models_py3 import ScriptSecureStringExecutionParameter - from ._models_py3 import ScriptStringExecutionParameter - from ._models_py3 import ServiceSpecification - from ._models_py3 import Sku - from ._models_py3 import TrackedResource - from ._models_py3 import Trial - from ._models_py3 import VirtualMachine - from ._models_py3 import VirtualMachineRestrictMovement - from ._models_py3 import VirtualMachinesList - from ._models_py3 import VmHostPlacementPolicyProperties - from ._models_py3 import VmPlacementPolicyProperties - from ._models_py3 import WorkloadNetworkDhcp - from ._models_py3 import WorkloadNetworkDhcpEntity - from ._models_py3 import WorkloadNetworkDhcpList - from ._models_py3 import WorkloadNetworkDhcpRelay - from ._models_py3 import WorkloadNetworkDhcpServer - from ._models_py3 import WorkloadNetworkDnsService - from ._models_py3 import WorkloadNetworkDnsServicesList - from ._models_py3 import WorkloadNetworkDnsZone - from ._models_py3 import WorkloadNetworkDnsZonesList - from ._models_py3 import WorkloadNetworkGateway - from ._models_py3 import WorkloadNetworkGatewayList - from ._models_py3 import WorkloadNetworkPortMirroring - from ._models_py3 import WorkloadNetworkPortMirroringList - from ._models_py3 import WorkloadNetworkPublicIP - from ._models_py3 import WorkloadNetworkPublicIPsList - from ._models_py3 import WorkloadNetworkSegment - from ._models_py3 import WorkloadNetworkSegmentPortVif - from ._models_py3 import WorkloadNetworkSegmentSubnet - from ._models_py3 import WorkloadNetworkSegmentsList - from ._models_py3 import WorkloadNetworkVMGroup - from ._models_py3 import WorkloadNetworkVMGroupsList - from ._models_py3 import WorkloadNetworkVirtualMachine - from ._models_py3 import WorkloadNetworkVirtualMachinesList -except (SyntaxError, ImportError): - from ._models import Addon # type: ignore - from ._models import AddonHcxProperties # type: ignore - from ._models import AddonList # type: ignore - from ._models import AddonProperties # type: ignore - from ._models import AddonSrmProperties # type: ignore - from ._models import AddonVrProperties # type: ignore - from ._models import AdminCredentials # type: ignore - from ._models import AvailabilityProperties # type: ignore - from ._models import Circuit # type: ignore - from ._models import CloudLink # type: ignore - from ._models import CloudLinkList # type: ignore - from ._models import Cluster # type: ignore - from ._models import ClusterList # type: ignore - from ._models import ClusterProperties # type: ignore - from ._models import ClusterUpdate # type: ignore - from ._models import CommonClusterProperties # type: ignore - from ._models import Datastore # type: ignore - from ._models import DatastoreList # type: ignore - from ._models import DiskPoolVolume # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionKeyVaultProperties # type: ignore - from ._models import Endpoints # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import ExpressRouteAuthorization # type: ignore - from ._models import ExpressRouteAuthorizationList # type: ignore - from ._models import GlobalReachConnection # type: ignore - from ._models import GlobalReachConnectionList # type: ignore - from ._models import HcxEnterpriseSite # type: ignore - from ._models import HcxEnterpriseSiteList # type: ignore - from ._models import IdentitySource # type: ignore - from ._models import LogSpecification # type: ignore - from ._models import ManagementCluster # type: ignore - from ._models import MetricDimension # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import NetAppVolume # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationList # type: ignore - from ._models import OperationProperties # type: ignore - from ._models import PSCredentialExecutionParameter # type: ignore - from ._models import PlacementPoliciesList # type: ignore - from ._models import PlacementPolicy # type: ignore - from ._models import PlacementPolicyProperties # type: ignore - from ._models import PlacementPolicyUpdate # type: ignore - from ._models import PrivateCloud # type: ignore - from ._models import PrivateCloudIdentity # type: ignore - from ._models import PrivateCloudList # type: ignore - from ._models import PrivateCloudProperties # type: ignore - from ._models import PrivateCloudUpdate # type: ignore - from ._models import PrivateCloudUpdateProperties # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Quota # type: ignore - from ._models import Resource # type: ignore - from ._models import ScriptCmdlet # type: ignore - from ._models import ScriptCmdletsList # type: ignore - from ._models import ScriptExecution # type: ignore - from ._models import ScriptExecutionParameter # type: ignore - from ._models import ScriptExecutionsList # type: ignore - from ._models import ScriptPackage # type: ignore - from ._models import ScriptPackagesList # type: ignore - from ._models import ScriptParameter # type: ignore - from ._models import ScriptSecureStringExecutionParameter # type: ignore - from ._models import ScriptStringExecutionParameter # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import Trial # type: ignore - from ._models import VirtualMachine # type: ignore - from ._models import VirtualMachineRestrictMovement # type: ignore - from ._models import VirtualMachinesList # type: ignore - from ._models import VmHostPlacementPolicyProperties # type: ignore - from ._models import VmPlacementPolicyProperties # type: ignore - from ._models import WorkloadNetworkDhcp # type: ignore - from ._models import WorkloadNetworkDhcpEntity # type: ignore - from ._models import WorkloadNetworkDhcpList # type: ignore - from ._models import WorkloadNetworkDhcpRelay # type: ignore - from ._models import WorkloadNetworkDhcpServer # type: ignore - from ._models import WorkloadNetworkDnsService # type: ignore - from ._models import WorkloadNetworkDnsServicesList # type: ignore - from ._models import WorkloadNetworkDnsZone # type: ignore - from ._models import WorkloadNetworkDnsZonesList # type: ignore - from ._models import WorkloadNetworkGateway # type: ignore - from ._models import WorkloadNetworkGatewayList # type: ignore - from ._models import WorkloadNetworkPortMirroring # type: ignore - from ._models import WorkloadNetworkPortMirroringList # type: ignore - from ._models import WorkloadNetworkPublicIP # type: ignore - from ._models import WorkloadNetworkPublicIPsList # type: ignore - from ._models import WorkloadNetworkSegment # type: ignore - from ._models import WorkloadNetworkSegmentPortVif # type: ignore - from ._models import WorkloadNetworkSegmentSubnet # type: ignore - from ._models import WorkloadNetworkSegmentsList # type: ignore - from ._models import WorkloadNetworkVMGroup # type: ignore - from ._models import WorkloadNetworkVMGroupsList # type: ignore - from ._models import WorkloadNetworkVirtualMachine # type: ignore - from ._models import WorkloadNetworkVirtualMachinesList # type: ignore +from ._models_py3 import Addon +from ._models_py3 import AddonHcxProperties +from ._models_py3 import AddonList +from ._models_py3 import AddonProperties +from ._models_py3 import AddonSrmProperties +from ._models_py3 import AddonVrProperties +from ._models_py3 import AdminCredentials +from ._models_py3 import AvailabilityProperties +from ._models_py3 import Circuit +from ._models_py3 import CloudLink +from ._models_py3 import CloudLinkList +from ._models_py3 import Cluster +from ._models_py3 import ClusterList +from ._models_py3 import ClusterProperties +from ._models_py3 import ClusterUpdate +from ._models_py3 import CommonClusterProperties +from ._models_py3 import Datastore +from ._models_py3 import DatastoreList +from ._models_py3 import DiskPoolVolume +from ._models_py3 import Encryption +from ._models_py3 import EncryptionKeyVaultProperties +from ._models_py3 import Endpoints +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorResponse +from ._models_py3 import ExpressRouteAuthorization +from ._models_py3 import ExpressRouteAuthorizationList +from ._models_py3 import GlobalReachConnection +from ._models_py3 import GlobalReachConnectionList +from ._models_py3 import HcxEnterpriseSite +from ._models_py3 import HcxEnterpriseSiteList +from ._models_py3 import IdentitySource +from ._models_py3 import LogSpecification +from ._models_py3 import ManagementCluster +from ._models_py3 import MetricDimension +from ._models_py3 import MetricSpecification +from ._models_py3 import NetAppVolume +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationList +from ._models_py3 import OperationProperties +from ._models_py3 import PSCredentialExecutionParameter +from ._models_py3 import PlacementPoliciesList +from ._models_py3 import PlacementPolicy +from ._models_py3 import PlacementPolicyProperties +from ._models_py3 import PlacementPolicyUpdate +from ._models_py3 import PrivateCloud +from ._models_py3 import PrivateCloudIdentity +from ._models_py3 import PrivateCloudList +from ._models_py3 import PrivateCloudProperties +from ._models_py3 import PrivateCloudUpdate +from ._models_py3 import PrivateCloudUpdateProperties +from ._models_py3 import ProxyResource +from ._models_py3 import Quota +from ._models_py3 import Resource +from ._models_py3 import ScriptCmdlet +from ._models_py3 import ScriptCmdletsList +from ._models_py3 import ScriptExecution +from ._models_py3 import ScriptExecutionParameter +from ._models_py3 import ScriptExecutionsList +from ._models_py3 import ScriptPackage +from ._models_py3 import ScriptPackagesList +from ._models_py3 import ScriptParameter +from ._models_py3 import ScriptSecureStringExecutionParameter +from ._models_py3 import ScriptStringExecutionParameter +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import TrackedResource +from ._models_py3 import Trial +from ._models_py3 import VirtualMachine +from ._models_py3 import VirtualMachineRestrictMovement +from ._models_py3 import VirtualMachinesList +from ._models_py3 import VmHostPlacementPolicyProperties +from ._models_py3 import VmPlacementPolicyProperties +from ._models_py3 import WorkloadNetworkDhcp +from ._models_py3 import WorkloadNetworkDhcpEntity +from ._models_py3 import WorkloadNetworkDhcpList +from ._models_py3 import WorkloadNetworkDhcpRelay +from ._models_py3 import WorkloadNetworkDhcpServer +from ._models_py3 import WorkloadNetworkDnsService +from ._models_py3 import WorkloadNetworkDnsServicesList +from ._models_py3 import WorkloadNetworkDnsZone +from ._models_py3 import WorkloadNetworkDnsZonesList +from ._models_py3 import WorkloadNetworkGateway +from ._models_py3 import WorkloadNetworkGatewayList +from ._models_py3 import WorkloadNetworkPortMirroring +from ._models_py3 import WorkloadNetworkPortMirroringList +from ._models_py3 import WorkloadNetworkPublicIP +from ._models_py3 import WorkloadNetworkPublicIPsList +from ._models_py3 import WorkloadNetworkSegment +from ._models_py3 import WorkloadNetworkSegmentPortVif +from ._models_py3 import WorkloadNetworkSegmentSubnet +from ._models_py3 import WorkloadNetworkSegmentsList +from ._models_py3 import WorkloadNetworkVMGroup +from ._models_py3 import WorkloadNetworkVMGroupsList +from ._models_py3 import WorkloadNetworkVirtualMachine +from ._models_py3 import WorkloadNetworkVirtualMachinesList + from ._avs_client_enums import ( AddonProvisioningState, diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_avs_client_enums.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_avs_client_enums.py index 8ce01af77eca..ad4a148dcb70 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_avs_client_enums.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_avs_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AddonProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AddonProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the addon provisioning """ @@ -37,7 +22,7 @@ class AddonProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) DELETING = "Deleting" UPDATING = "Updating" -class AddonType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AddonType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of private cloud addon """ @@ -45,21 +30,21 @@ class AddonType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): VR = "VR" HCX = "HCX" -class AffinityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AffinityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Placement policy affinity type """ AFFINITY = "Affinity" ANTI_AFFINITY = "AntiAffinity" -class AvailabilityStrategy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AvailabilityStrategy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The availability strategy for the private cloud """ SINGLE_ZONE = "SingleZone" DUAL_ZONE = "DualZone" -class CloudLinkStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CloudLinkStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the cloud link. """ @@ -69,7 +54,7 @@ class CloudLinkStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" DISCONNECTED = "Disconnected" -class ClusterProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the cluster provisioning """ @@ -79,7 +64,7 @@ class ClusterProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu DELETING = "Deleting" UPDATING = "Updating" -class DatastoreProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DatastoreProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the datastore provisioning """ @@ -91,7 +76,7 @@ class DatastoreProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, E UPDATING = "Updating" DELETING = "Deleting" -class DatastoreStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DatastoreStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operational status of the datastore """ @@ -103,14 +88,14 @@ class DatastoreStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): LOST_COMMUNICATION = "LostCommunication" DEAD_OR_ERROR = "DeadOrError" -class DhcpTypeEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DhcpTypeEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of DHCP: SERVER or RELAY. """ SERVER = "SERVER" RELAY = "RELAY" -class DnsServiceLogLevelEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DnsServiceLogLevelEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """DNS Service log level. """ @@ -120,35 +105,35 @@ class DnsServiceLogLevelEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) ERROR = "ERROR" FATAL = "FATAL" -class DnsServiceStatusEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DnsServiceStatusEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """DNS Service status. """ SUCCESS = "SUCCESS" FAILURE = "FAILURE" -class EncryptionKeyStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionKeyStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of key provided """ CONNECTED = "Connected" ACCESS_DENIED = "AccessDenied" -class EncryptionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of customer managed encryption key """ ENABLED = "Enabled" DISABLED = "Disabled" -class EncryptionVersionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionVersionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Property of the key if user provided or auto detected """ FIXED = "Fixed" AUTO_DETECTED = "AutoDetected" -class ExpressRouteAuthorizationProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExpressRouteAuthorizationProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the ExpressRoute Circuit Authorization provisioning """ @@ -156,7 +141,7 @@ class ExpressRouteAuthorizationProvisioningState(with_metaclass(_CaseInsensitive FAILED = "Failed" UPDATING = "Updating" -class GlobalReachConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GlobalReachConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the ExpressRoute Circuit Authorization provisioning """ @@ -164,7 +149,7 @@ class GlobalReachConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnum FAILED = "Failed" UPDATING = "Updating" -class GlobalReachConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GlobalReachConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The connection status of the global reach connection """ @@ -172,7 +157,7 @@ class GlobalReachConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, CONNECTING = "Connecting" DISCONNECTED = "Disconnected" -class HcxEnterpriseSiteStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HcxEnterpriseSiteStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the HCX Enterprise Site """ @@ -181,28 +166,28 @@ class HcxEnterpriseSiteStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum DEACTIVATED = "Deactivated" DELETED = "Deleted" -class InternetEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InternetEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Connectivity to internet is enabled or disabled """ ENABLED = "Enabled" DISABLED = "Disabled" -class MountOptionEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MountOptionEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Mode that describes whether the LUN has to be mounted as a datastore or attached as a LUN """ MOUNT = "MOUNT" ATTACH = "ATTACH" -class OptionalParamEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OptionalParamEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Is this parameter required or optional """ OPTIONAL = "Optional" REQUIRED = "Required" -class PlacementPolicyProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PlacementPolicyProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state """ @@ -212,21 +197,21 @@ class PlacementPolicyProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, DELETING = "Deleting" UPDATING = "Updating" -class PlacementPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PlacementPolicyState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether the placement policy is enabled or disabled """ ENABLED = "Enabled" DISABLED = "Disabled" -class PlacementPolicyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PlacementPolicyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """placement policy type """ VM_VM = "VmVm" VM_HOST = "VmHost" -class PortMirroringDirectionEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PortMirroringDirectionEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Direction of port mirroring profile. """ @@ -234,14 +219,14 @@ class PortMirroringDirectionEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, E EGRESS = "EGRESS" BIDIRECTIONAL = "BIDIRECTIONAL" -class PortMirroringStatusEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PortMirroringStatusEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Port Mirroring Status. """ SUCCESS = "SUCCESS" FAILURE = "FAILURE" -class PrivateCloudProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateCloudProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state """ @@ -253,14 +238,14 @@ class PrivateCloudProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str DELETING = "Deleting" UPDATING = "Updating" -class QuotaEnabled(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class QuotaEnabled(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Host quota is active for current subscription """ ENABLED = "Enabled" DISABLED = "Disabled" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity used for the private cloud. The type 'SystemAssigned' refers to an implicitly created identity. The type 'None' will remove any identities from the Private Cloud. """ @@ -268,7 +253,7 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" -class ScriptExecutionParameterType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ScriptExecutionParameterType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of execution parameter """ @@ -276,7 +261,7 @@ class ScriptExecutionParameterType(with_metaclass(_CaseInsensitiveEnumMeta, str, SECURE_VALUE = "SecureValue" CREDENTIAL = "Credential" -class ScriptExecutionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ScriptExecutionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the script execution resource """ @@ -288,14 +273,14 @@ class ScriptExecutionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, CANCELLED = "Cancelled" DELETING = "Deleting" -class ScriptOutputStreamType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ScriptOutputStreamType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): INFORMATION = "Information" WARNING = "Warning" OUTPUT = "Output" ERROR = "Error" -class ScriptParameterTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ScriptParameterTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of parameter the script is expecting. psCredential is a PSCredentialObject """ @@ -306,21 +291,21 @@ class ScriptParameterTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BOOL = "Bool" FLOAT = "Float" -class SegmentStatusEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SegmentStatusEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Segment status. """ SUCCESS = "SUCCESS" FAILURE = "FAILURE" -class SslEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SslEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Protect LDAP communication using SSL certificate (LDAPS) """ ENABLED = "Enabled" DISABLED = "Disabled" -class TrialStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrialStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Trial status """ @@ -328,28 +313,28 @@ class TrialStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TRIAL_USED = "TrialUsed" TRIAL_DISABLED = "TrialDisabled" -class VirtualMachineRestrictMovementState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VirtualMachineRestrictMovementState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether VM DRS-driven movement is restricted (enabled) or not (disabled) """ ENABLED = "Enabled" DISABLED = "Disabled" -class VisibilityParameterEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VisibilityParameterEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Should this parameter be visible to arm and passed in the parameters argument when executing """ VISIBLE = "Visible" HIDDEN = "Hidden" -class VMGroupStatusEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMGroupStatusEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """VM Group status. """ SUCCESS = "SUCCESS" FAILURE = "FAILURE" -class VMTypeEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VMTypeEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Virtual machine type. """ @@ -357,7 +342,7 @@ class VMTypeEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): EDGE = "EDGE" SERVICE = "SERVICE" -class WorkloadNetworkDhcpProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadNetworkDhcpProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state """ @@ -367,7 +352,7 @@ class WorkloadNetworkDhcpProvisioningState(with_metaclass(_CaseInsensitiveEnumMe DELETING = "Deleting" UPDATING = "Updating" -class WorkloadNetworkDnsServiceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadNetworkDnsServiceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state """ @@ -377,7 +362,7 @@ class WorkloadNetworkDnsServiceProvisioningState(with_metaclass(_CaseInsensitive DELETING = "Deleting" UPDATING = "Updating" -class WorkloadNetworkDnsZoneProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadNetworkDnsZoneProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state """ @@ -387,7 +372,7 @@ class WorkloadNetworkDnsZoneProvisioningState(with_metaclass(_CaseInsensitiveEnu DELETING = "Deleting" UPDATING = "Updating" -class WorkloadNetworkPortMirroringProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadNetworkPortMirroringProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state """ @@ -397,7 +382,7 @@ class WorkloadNetworkPortMirroringProvisioningState(with_metaclass(_CaseInsensit DELETING = "Deleting" UPDATING = "Updating" -class WorkloadNetworkPublicIPProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadNetworkPublicIPProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state """ @@ -407,7 +392,7 @@ class WorkloadNetworkPublicIPProvisioningState(with_metaclass(_CaseInsensitiveEn DELETING = "Deleting" UPDATING = "Updating" -class WorkloadNetworkSegmentProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadNetworkSegmentProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state """ @@ -417,7 +402,7 @@ class WorkloadNetworkSegmentProvisioningState(with_metaclass(_CaseInsensitiveEnu DELETING = "Deleting" UPDATING = "Updating" -class WorkloadNetworkVMGroupProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadNetworkVMGroupProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state """ diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_models.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_models.py deleted file mode 100644 index d5a57dcf7e33..000000000000 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_models.py +++ /dev/null @@ -1,3922 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class Resource(msrest.serialization.Model): - """The core properties of ARM resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class Addon(Resource): - """An addon resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param properties: The properties of an addon resource. - :type properties: ~azure.mgmt.avs.models.AddonProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'AddonProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Addon, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class AddonProperties(msrest.serialization.Model): - """The properties of an addon. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AddonHcxProperties, AddonSrmProperties, AddonVrProperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param addon_type: Required. The type of private cloud addon.Constant filled by server. - Possible values include: "SRM", "VR", "HCX". - :type addon_type: str or ~azure.mgmt.avs.models.AddonType - :ivar provisioning_state: The state of the addon provisioning. Possible values include: - "Succeeded", "Failed", "Cancelled", "Building", "Deleting", "Updating". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState - """ - - _validation = { - 'addon_type': {'required': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'addon_type': {'key': 'addonType', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - } - - _subtype_map = { - 'addon_type': {'HCX': 'AddonHcxProperties', 'SRM': 'AddonSrmProperties', 'VR': 'AddonVrProperties'} - } - - def __init__( - self, - **kwargs - ): - super(AddonProperties, self).__init__(**kwargs) - self.addon_type = None # type: Optional[str] - self.provisioning_state = None - - -class AddonHcxProperties(AddonProperties): - """The properties of an HCX addon. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param addon_type: Required. The type of private cloud addon.Constant filled by server. - Possible values include: "SRM", "VR", "HCX". - :type addon_type: str or ~azure.mgmt.avs.models.AddonType - :ivar provisioning_state: The state of the addon provisioning. Possible values include: - "Succeeded", "Failed", "Cancelled", "Building", "Deleting", "Updating". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState - :param offer: Required. The HCX offer, example VMware MaaS Cloud Provider (Enterprise). - :type offer: str - """ - - _validation = { - 'addon_type': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'offer': {'required': True}, - } - - _attribute_map = { - 'addon_type': {'key': 'addonType', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'offer': {'key': 'offer', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AddonHcxProperties, self).__init__(**kwargs) - self.addon_type = 'HCX' # type: str - self.offer = kwargs['offer'] - - -class AddonList(msrest.serialization.Model): - """A paged list of addons. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The items on a page. - :vartype value: list[~azure.mgmt.avs.models.Addon] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Addon]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AddonList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class AddonSrmProperties(AddonProperties): - """The properties of a Site Recovery Manager (SRM) addon. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param addon_type: Required. The type of private cloud addon.Constant filled by server. - Possible values include: "SRM", "VR", "HCX". - :type addon_type: str or ~azure.mgmt.avs.models.AddonType - :ivar provisioning_state: The state of the addon provisioning. Possible values include: - "Succeeded", "Failed", "Cancelled", "Building", "Deleting", "Updating". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState - :param license_key: The Site Recovery Manager (SRM) license. - :type license_key: str - """ - - _validation = { - 'addon_type': {'required': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'addon_type': {'key': 'addonType', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'license_key': {'key': 'licenseKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AddonSrmProperties, self).__init__(**kwargs) - self.addon_type = 'SRM' # type: str - self.license_key = kwargs.get('license_key', None) - - -class AddonVrProperties(AddonProperties): - """The properties of a vSphere Replication (VR) addon. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param addon_type: Required. The type of private cloud addon.Constant filled by server. - Possible values include: "SRM", "VR", "HCX". - :type addon_type: str or ~azure.mgmt.avs.models.AddonType - :ivar provisioning_state: The state of the addon provisioning. Possible values include: - "Succeeded", "Failed", "Cancelled", "Building", "Deleting", "Updating". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState - :param vrs_count: Required. The vSphere Replication Server (VRS) count. - :type vrs_count: int - """ - - _validation = { - 'addon_type': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'vrs_count': {'required': True}, - } - - _attribute_map = { - 'addon_type': {'key': 'addonType', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'vrs_count': {'key': 'vrsCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AddonVrProperties, self).__init__(**kwargs) - self.addon_type = 'VR' # type: str - self.vrs_count = kwargs['vrs_count'] - - -class AdminCredentials(msrest.serialization.Model): - """Administrative credentials for accessing vCenter and NSX-T. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar nsxt_username: NSX-T Manager username. - :vartype nsxt_username: str - :ivar nsxt_password: NSX-T Manager password. - :vartype nsxt_password: str - :ivar vcenter_username: vCenter admin username. - :vartype vcenter_username: str - :ivar vcenter_password: vCenter admin password. - :vartype vcenter_password: str - """ - - _validation = { - 'nsxt_username': {'readonly': True}, - 'nsxt_password': {'readonly': True}, - 'vcenter_username': {'readonly': True}, - 'vcenter_password': {'readonly': True}, - } - - _attribute_map = { - 'nsxt_username': {'key': 'nsxtUsername', 'type': 'str'}, - 'nsxt_password': {'key': 'nsxtPassword', 'type': 'str'}, - 'vcenter_username': {'key': 'vcenterUsername', 'type': 'str'}, - 'vcenter_password': {'key': 'vcenterPassword', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AdminCredentials, self).__init__(**kwargs) - self.nsxt_username = None - self.nsxt_password = None - self.vcenter_username = None - self.vcenter_password = None - - -class AvailabilityProperties(msrest.serialization.Model): - """The properties describing private cloud availability zone distribution. - - :param strategy: The availability strategy for the private cloud. Possible values include: - "SingleZone", "DualZone". - :type strategy: str or ~azure.mgmt.avs.models.AvailabilityStrategy - :param zone: The primary availability zone for the private cloud. - :type zone: int - :param secondary_zone: The secondary availability zone for the private cloud. - :type secondary_zone: int - """ - - _attribute_map = { - 'strategy': {'key': 'strategy', 'type': 'str'}, - 'zone': {'key': 'zone', 'type': 'int'}, - 'secondary_zone': {'key': 'secondaryZone', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailabilityProperties, self).__init__(**kwargs) - self.strategy = kwargs.get('strategy', None) - self.zone = kwargs.get('zone', None) - self.secondary_zone = kwargs.get('secondary_zone', None) - - -class Circuit(msrest.serialization.Model): - """An ExpressRoute Circuit. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar primary_subnet: CIDR of primary subnet. - :vartype primary_subnet: str - :ivar secondary_subnet: CIDR of secondary subnet. - :vartype secondary_subnet: str - :ivar express_route_id: Identifier of the ExpressRoute Circuit (Microsoft Colo only). - :vartype express_route_id: str - :ivar express_route_private_peering_id: ExpressRoute Circuit private peering identifier. - :vartype express_route_private_peering_id: str - """ - - _validation = { - 'primary_subnet': {'readonly': True}, - 'secondary_subnet': {'readonly': True}, - 'express_route_id': {'readonly': True}, - 'express_route_private_peering_id': {'readonly': True}, - } - - _attribute_map = { - 'primary_subnet': {'key': 'primarySubnet', 'type': 'str'}, - 'secondary_subnet': {'key': 'secondarySubnet', 'type': 'str'}, - 'express_route_id': {'key': 'expressRouteID', 'type': 'str'}, - 'express_route_private_peering_id': {'key': 'expressRoutePrivatePeeringID', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Circuit, self).__init__(**kwargs) - self.primary_subnet = None - self.secondary_subnet = None - self.express_route_id = None - self.express_route_private_peering_id = None - - -class CloudLink(Resource): - """A cloud link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar status: The state of the cloud link. Possible values include: "Active", "Building", - "Deleting", "Failed", "Disconnected". - :vartype status: str or ~azure.mgmt.avs.models.CloudLinkStatus - :param linked_cloud: Identifier of the other private cloud participating in the link. - :type linked_cloud: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'linked_cloud': {'key': 'properties.linkedCloud', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudLink, self).__init__(**kwargs) - self.status = None - self.linked_cloud = kwargs.get('linked_cloud', None) - - -class CloudLinkList(msrest.serialization.Model): - """A paged list of cloud links. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The items on a page. - :vartype value: list[~azure.mgmt.avs.models.CloudLink] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CloudLink]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudLinkList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class Cluster(Resource): - """A cluster resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param sku: Required. The cluster SKU. - :type sku: ~azure.mgmt.avs.models.Sku - :param cluster_size: The cluster size. - :type cluster_size: int - :ivar provisioning_state: The state of the cluster provisioning. Possible values include: - "Succeeded", "Failed", "Cancelled", "Deleting", "Updating". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState - :ivar cluster_id: The identity. - :vartype cluster_id: int - :param hosts: The hosts. - :type hosts: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'sku': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'cluster_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'cluster_size': {'key': 'properties.clusterSize', 'type': 'int'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'cluster_id': {'key': 'properties.clusterId', 'type': 'int'}, - 'hosts': {'key': 'properties.hosts', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(Cluster, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.cluster_size = kwargs.get('cluster_size', None) - self.provisioning_state = None - self.cluster_id = None - self.hosts = kwargs.get('hosts', None) - - -class ClusterList(msrest.serialization.Model): - """A paged list of clusters. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The items on a page. - :vartype value: list[~azure.mgmt.avs.models.Cluster] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Cluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class CommonClusterProperties(msrest.serialization.Model): - """The common properties of a cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param cluster_size: The cluster size. - :type cluster_size: int - :ivar provisioning_state: The state of the cluster provisioning. Possible values include: - "Succeeded", "Failed", "Cancelled", "Deleting", "Updating". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState - :ivar cluster_id: The identity. - :vartype cluster_id: int - :param hosts: The hosts. - :type hosts: list[str] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'cluster_id': {'readonly': True}, - } - - _attribute_map = { - 'cluster_size': {'key': 'clusterSize', 'type': 'int'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'cluster_id': {'key': 'clusterId', 'type': 'int'}, - 'hosts': {'key': 'hosts', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(CommonClusterProperties, self).__init__(**kwargs) - self.cluster_size = kwargs.get('cluster_size', None) - self.provisioning_state = None - self.cluster_id = None - self.hosts = kwargs.get('hosts', None) - - -class ClusterProperties(CommonClusterProperties): - """The properties of a cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param cluster_size: The cluster size. - :type cluster_size: int - :ivar provisioning_state: The state of the cluster provisioning. Possible values include: - "Succeeded", "Failed", "Cancelled", "Deleting", "Updating". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState - :ivar cluster_id: The identity. - :vartype cluster_id: int - :param hosts: The hosts. - :type hosts: list[str] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'cluster_id': {'readonly': True}, - } - - _attribute_map = { - 'cluster_size': {'key': 'clusterSize', 'type': 'int'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'cluster_id': {'key': 'clusterId', 'type': 'int'}, - 'hosts': {'key': 'hosts', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterProperties, self).__init__(**kwargs) - - -class ClusterUpdate(msrest.serialization.Model): - """An update of a cluster resource. - - :param cluster_size: The cluster size. - :type cluster_size: int - :param hosts: The hosts. - :type hosts: list[str] - """ - - _attribute_map = { - 'cluster_size': {'key': 'properties.clusterSize', 'type': 'int'}, - 'hosts': {'key': 'properties.hosts', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterUpdate, self).__init__(**kwargs) - self.cluster_size = kwargs.get('cluster_size', None) - self.hosts = kwargs.get('hosts', None) - - -class Datastore(Resource): - """A datastore resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar provisioning_state: The state of the datastore provisioning. Possible values include: - "Succeeded", "Failed", "Cancelled", "Pending", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.DatastoreProvisioningState - :param net_app_volume: An Azure NetApp Files volume. - :type net_app_volume: ~azure.mgmt.avs.models.NetAppVolume - :param disk_pool_volume: An iSCSI volume. - :type disk_pool_volume: ~azure.mgmt.avs.models.DiskPoolVolume - :ivar status: The operational status of the datastore. Possible values include: "Unknown", - "Accessible", "Inaccessible", "Attached", "Detached", "LostCommunication", "DeadOrError". - :vartype status: str or ~azure.mgmt.avs.models.DatastoreStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'net_app_volume': {'key': 'properties.netAppVolume', 'type': 'NetAppVolume'}, - 'disk_pool_volume': {'key': 'properties.diskPoolVolume', 'type': 'DiskPoolVolume'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Datastore, self).__init__(**kwargs) - self.provisioning_state = None - self.net_app_volume = kwargs.get('net_app_volume', None) - self.disk_pool_volume = kwargs.get('disk_pool_volume', None) - self.status = None - - -class DatastoreList(msrest.serialization.Model): - """A paged list of datastores. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The items on a page. - :vartype value: list[~azure.mgmt.avs.models.Datastore] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Datastore]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DatastoreList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DiskPoolVolume(msrest.serialization.Model): - """An iSCSI volume from Microsoft.StoragePool provider. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param target_id: Required. Azure resource ID of the iSCSI target. - :type target_id: str - :param lun_name: Required. Name of the LUN to be used for datastore. - :type lun_name: str - :param mount_option: Mode that describes whether the LUN has to be mounted as a datastore or - attached as a LUN. Possible values include: "MOUNT", "ATTACH". Default value: "MOUNT". - :type mount_option: str or ~azure.mgmt.avs.models.MountOptionEnum - :ivar path: Device path. - :vartype path: str - """ - - _validation = { - 'target_id': {'required': True}, - 'lun_name': {'required': True}, - 'path': {'readonly': True}, - } - - _attribute_map = { - 'target_id': {'key': 'targetId', 'type': 'str'}, - 'lun_name': {'key': 'lunName', 'type': 'str'}, - 'mount_option': {'key': 'mountOption', 'type': 'str'}, - 'path': {'key': 'path', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskPoolVolume, self).__init__(**kwargs) - self.target_id = kwargs['target_id'] - self.lun_name = kwargs['lun_name'] - self.mount_option = kwargs.get('mount_option', "MOUNT") - self.path = None - - -class Encryption(msrest.serialization.Model): - """The properties of customer managed encryption key. - - :param status: Status of customer managed encryption key. Possible values include: "Enabled", - "Disabled". - :type status: str or ~azure.mgmt.avs.models.EncryptionState - :param key_vault_properties: The key vault where the encryption key is stored. - :type key_vault_properties: ~azure.mgmt.avs.models.EncryptionKeyVaultProperties - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'EncryptionKeyVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.key_vault_properties = kwargs.get('key_vault_properties', None) - - -class EncryptionKeyVaultProperties(msrest.serialization.Model): - """An Encryption Key. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param key_name: The name of the key. - :type key_name: str - :param key_version: The version of the key. - :type key_version: str - :param key_vault_url: The URL of the vault. - :type key_vault_url: str - :ivar key_state: The state of key provided. Possible values include: "Connected", - "AccessDenied". - :vartype key_state: str or ~azure.mgmt.avs.models.EncryptionKeyStatus - :ivar version_type: Property of the key if user provided or auto detected. Possible values - include: "Fixed", "AutoDetected". - :vartype version_type: str or ~azure.mgmt.avs.models.EncryptionVersionType - """ - - _validation = { - 'key_state': {'readonly': True}, - 'version_type': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'key_version': {'key': 'keyVersion', 'type': 'str'}, - 'key_vault_url': {'key': 'keyVaultUrl', 'type': 'str'}, - 'key_state': {'key': 'keyState', 'type': 'str'}, - 'version_type': {'key': 'versionType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionKeyVaultProperties, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) - self.key_version = kwargs.get('key_version', None) - self.key_vault_url = kwargs.get('key_vault_url', None) - self.key_state = None - self.version_type = None - - -class Endpoints(msrest.serialization.Model): - """Endpoint addresses. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar nsxt_manager: Endpoint for the NSX-T Data Center manager. - :vartype nsxt_manager: str - :ivar vcsa: Endpoint for Virtual Center Server Appliance. - :vartype vcsa: str - :ivar hcx_cloud_manager: Endpoint for the HCX Cloud Manager. - :vartype hcx_cloud_manager: str - """ - - _validation = { - 'nsxt_manager': {'readonly': True}, - 'vcsa': {'readonly': True}, - 'hcx_cloud_manager': {'readonly': True}, - } - - _attribute_map = { - 'nsxt_manager': {'key': 'nsxtManager', 'type': 'str'}, - 'vcsa': {'key': 'vcsa', 'type': 'str'}, - 'hcx_cloud_manager': {'key': 'hcxCloudManager', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Endpoints, self).__init__(**kwargs) - self.nsxt_manager = None - self.vcsa = None - self.hcx_cloud_manager = None - - -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorResponse(msrest.serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.avs.models.ErrorResponse] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.avs.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorResponse]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ExpressRouteAuthorization(Resource): - """ExpressRoute Circuit Authorization. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar provisioning_state: The state of the ExpressRoute Circuit Authorization provisioning. - Possible values include: "Succeeded", "Failed", "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.avs.models.ExpressRouteAuthorizationProvisioningState - :ivar express_route_authorization_id: The ID of the ExpressRoute Circuit Authorization. - :vartype express_route_authorization_id: str - :ivar express_route_authorization_key: The key of the ExpressRoute Circuit Authorization. - :vartype express_route_authorization_key: str - :param express_route_id: The ID of the ExpressRoute Circuit. - :type express_route_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'express_route_authorization_id': {'readonly': True}, - 'express_route_authorization_key': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'express_route_authorization_id': {'key': 'properties.expressRouteAuthorizationId', 'type': 'str'}, - 'express_route_authorization_key': {'key': 'properties.expressRouteAuthorizationKey', 'type': 'str'}, - 'express_route_id': {'key': 'properties.expressRouteId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExpressRouteAuthorization, self).__init__(**kwargs) - self.provisioning_state = None - self.express_route_authorization_id = None - self.express_route_authorization_key = None - self.express_route_id = kwargs.get('express_route_id', None) - - -class ExpressRouteAuthorizationList(msrest.serialization.Model): - """A paged list of ExpressRoute Circuit Authorizations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The items on a page. - :vartype value: list[~azure.mgmt.avs.models.ExpressRouteAuthorization] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ExpressRouteAuthorization]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExpressRouteAuthorizationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class GlobalReachConnection(Resource): - """A global reach connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar provisioning_state: The state of the ExpressRoute Circuit Authorization provisioning. - Possible values include: "Succeeded", "Failed", "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.avs.models.GlobalReachConnectionProvisioningState - :ivar address_prefix: The network used for global reach carved out from the original network - block provided for the private cloud. - :vartype address_prefix: str - :param authorization_key: Authorization key from the peer express route used for the global - reach connection. - :type authorization_key: str - :ivar circuit_connection_status: The connection status of the global reach connection. Possible - values include: "Connected", "Connecting", "Disconnected". - :vartype circuit_connection_status: str or ~azure.mgmt.avs.models.GlobalReachConnectionStatus - :param peer_express_route_circuit: Identifier of the ExpressRoute Circuit to peer with in the - global reach connection. - :type peer_express_route_circuit: str - :param express_route_id: The ID of the Private Cloud's ExpressRoute Circuit that is - participating in the global reach connection. - :type express_route_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'address_prefix': {'readonly': True}, - 'circuit_connection_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'address_prefix': {'key': 'properties.addressPrefix', 'type': 'str'}, - 'authorization_key': {'key': 'properties.authorizationKey', 'type': 'str'}, - 'circuit_connection_status': {'key': 'properties.circuitConnectionStatus', 'type': 'str'}, - 'peer_express_route_circuit': {'key': 'properties.peerExpressRouteCircuit', 'type': 'str'}, - 'express_route_id': {'key': 'properties.expressRouteId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GlobalReachConnection, self).__init__(**kwargs) - self.provisioning_state = None - self.address_prefix = None - self.authorization_key = kwargs.get('authorization_key', None) - self.circuit_connection_status = None - self.peer_express_route_circuit = kwargs.get('peer_express_route_circuit', None) - self.express_route_id = kwargs.get('express_route_id', None) - - -class GlobalReachConnectionList(msrest.serialization.Model): - """A paged list of global reach connections. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The items on a page. - :vartype value: list[~azure.mgmt.avs.models.GlobalReachConnection] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GlobalReachConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GlobalReachConnectionList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class HcxEnterpriseSite(Resource): - """An HCX Enterprise Site resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar activation_key: The activation key. - :vartype activation_key: str - :ivar status: The status of the HCX Enterprise Site. Possible values include: "Available", - "Consumed", "Deactivated", "Deleted". - :vartype status: str or ~azure.mgmt.avs.models.HcxEnterpriseSiteStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'activation_key': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'activation_key': {'key': 'properties.activationKey', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HcxEnterpriseSite, self).__init__(**kwargs) - self.activation_key = None - self.status = None - - -class HcxEnterpriseSiteList(msrest.serialization.Model): - """A paged list of HCX Enterprise Sites. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The items on a page. - :vartype value: list[~azure.mgmt.avs.models.HcxEnterpriseSite] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[HcxEnterpriseSite]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HcxEnterpriseSiteList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class IdentitySource(msrest.serialization.Model): - """vCenter Single Sign On Identity Source. - - :param name: The name of the identity source. - :type name: str - :param alias: The domain's NetBIOS name. - :type alias: str - :param domain: The domain's dns name. - :type domain: str - :param base_user_dn: The base distinguished name for users. - :type base_user_dn: str - :param base_group_dn: The base distinguished name for groups. - :type base_group_dn: str - :param primary_server: Primary server URL. - :type primary_server: str - :param secondary_server: Secondary server URL. - :type secondary_server: str - :param ssl: Protect LDAP communication using SSL certificate (LDAPS). Possible values include: - "Enabled", "Disabled". - :type ssl: str or ~azure.mgmt.avs.models.SslEnum - :param username: The ID of an Active Directory user with a minimum of read-only access to Base - DN for users and group. - :type username: str - :param password: The password of the Active Directory user with a minimum of read-only access - to Base DN for users and groups. - :type password: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'alias': {'key': 'alias', 'type': 'str'}, - 'domain': {'key': 'domain', 'type': 'str'}, - 'base_user_dn': {'key': 'baseUserDN', 'type': 'str'}, - 'base_group_dn': {'key': 'baseGroupDN', 'type': 'str'}, - 'primary_server': {'key': 'primaryServer', 'type': 'str'}, - 'secondary_server': {'key': 'secondaryServer', 'type': 'str'}, - 'ssl': {'key': 'ssl', 'type': 'str'}, - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IdentitySource, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.alias = kwargs.get('alias', None) - self.domain = kwargs.get('domain', None) - self.base_user_dn = kwargs.get('base_user_dn', None) - self.base_group_dn = kwargs.get('base_group_dn', None) - self.primary_server = kwargs.get('primary_server', None) - self.secondary_server = kwargs.get('secondary_server', None) - self.ssl = kwargs.get('ssl', None) - self.username = kwargs.get('username', None) - self.password = kwargs.get('password', None) - - -class LogSpecification(msrest.serialization.Model): - """Specifications of the Log for Azure Monitoring. - - :param name: Name of the log. - :type name: str - :param display_name: Localized friendly display name of the log. - :type display_name: str - :param blob_duration: Blob duration of the log. - :type blob_duration: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LogSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.blob_duration = kwargs.get('blob_duration', None) - - -class ManagementCluster(CommonClusterProperties): - """The properties of a management cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param cluster_size: The cluster size. - :type cluster_size: int - :ivar provisioning_state: The state of the cluster provisioning. Possible values include: - "Succeeded", "Failed", "Cancelled", "Deleting", "Updating". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState - :ivar cluster_id: The identity. - :vartype cluster_id: int - :param hosts: The hosts. - :type hosts: list[str] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'cluster_id': {'readonly': True}, - } - - _attribute_map = { - 'cluster_size': {'key': 'clusterSize', 'type': 'int'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'cluster_id': {'key': 'clusterId', 'type': 'int'}, - 'hosts': {'key': 'hosts', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementCluster, self).__init__(**kwargs) - - -class MetricDimension(msrest.serialization.Model): - """Specifications of the Dimension of metrics. - - :param name: Name of the dimension. - :type name: str - :param display_name: Localized friendly display name of the dimension. - :type display_name: str - :param internal_name: Name of the dimension as it appears in MDM. - :type internal_name: str - :param to_be_exported_for_shoebox: A boolean flag indicating whether this dimension should be - included for the shoebox export scenario. - :type to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'internal_name': {'key': 'internalName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricDimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.internal_name = kwargs.get('internal_name', None) - self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) - - -class MetricSpecification(msrest.serialization.Model): - """Specifications of the Metrics for Azure Monitoring. - - :param name: Name of the metric. - :type name: str - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :param unit: Unit that makes sense for the metric. - :type unit: str - :param category: Name of the metric category that the metric belongs to. A metric can only - belong to a single category. - :type category: str - :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, - Maximum, Total, Count. - :type aggregation_type: str - :param supported_aggregation_types: Supported aggregation types. - :type supported_aggregation_types: list[str] - :param supported_time_grain_types: Supported time grain types. - :type supported_time_grain_types: list[str] - :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time - duration where no metric is emitted/published. - :type fill_gap_with_zero: bool - :param dimensions: Dimensions of the metric. - :type dimensions: list[~azure.mgmt.avs.models.MetricDimension] - :param enable_regional_mdm_account: Whether or not the service is using regional MDM accounts. - :type enable_regional_mdm_account: str - :param source_mdm_account: The name of the MDM account. - :type source_mdm_account: str - :param source_mdm_namespace: The name of the MDM namespace. - :type source_mdm_namespace: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'category': {'key': 'category', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, - 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, - 'enable_regional_mdm_account': {'key': 'enableRegionalMdmAccount', 'type': 'str'}, - 'source_mdm_account': {'key': 'sourceMdmAccount', 'type': 'str'}, - 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.category = kwargs.get('category', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) - self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.dimensions = kwargs.get('dimensions', None) - self.enable_regional_mdm_account = kwargs.get('enable_regional_mdm_account', None) - self.source_mdm_account = kwargs.get('source_mdm_account', None) - self.source_mdm_namespace = kwargs.get('source_mdm_namespace', None) - - -class NetAppVolume(msrest.serialization.Model): - """An Azure NetApp Files volume from Microsoft.NetApp provider. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. Azure resource ID of the NetApp volume. - :type id: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetAppVolume, self).__init__(**kwargs) - self.id = kwargs['id'] - - -class Operation(msrest.serialization.Model): - """A REST API operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the operation being performed on this object. - :vartype name: str - :ivar display: Contains the localized display information for this operation. - :vartype display: ~azure.mgmt.avs.models.OperationDisplay - :param is_data_action: Gets or sets a value indicating whether the operation is a data action - or not. - :type is_data_action: bool - :param origin: Origin of the operation. - :type origin: str - :param properties: Properties of the operation. - :type properties: ~azure.mgmt.avs.models.OperationProperties - """ - - _validation = { - 'name': {'readonly': True}, - 'display': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OperationProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = None - self.display = None - self.is_data_action = kwargs.get('is_data_action', None) - self.origin = kwargs.get('origin', None) - self.properties = kwargs.get('properties', None) - - -class OperationDisplay(msrest.serialization.Model): - """Contains the localized display information for this operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: Localized friendly form of the resource provider name. - :vartype provider: str - :ivar resource: Localized friendly form of the resource type related to this operation. - :vartype resource: str - :ivar operation: Localized friendly name for the operation. - :vartype operation: str - :ivar description: Localized friendly description for the operation. - :vartype description: str - """ - - _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - 'description': {'readonly': True}, - } - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None - - -class OperationList(msrest.serialization.Model): - """Pageable list of operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations. - :vartype value: list[~azure.mgmt.avs.models.Operation] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class OperationProperties(msrest.serialization.Model): - """Extra Operation properties. - - :param service_specification: Service specifications of the operation. - :type service_specification: ~azure.mgmt.avs.models.ServiceSpecification - """ - - _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationProperties, self).__init__(**kwargs) - self.service_specification = kwargs.get('service_specification', None) - - -class PlacementPoliciesList(msrest.serialization.Model): - """Represents list of placement policies. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The items on the page. - :vartype value: list[~azure.mgmt.avs.models.PlacementPolicy] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PlacementPolicy]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PlacementPoliciesList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class PlacementPolicy(Resource): - """A vSphere Distributed Resource Scheduler (DRS) placement policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param properties: placement policy properties. - :type properties: ~azure.mgmt.avs.models.PlacementPolicyProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'PlacementPolicyProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(PlacementPolicy, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class PlacementPolicyProperties(msrest.serialization.Model): - """Abstract placement policy properties. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: VmHostPlacementPolicyProperties, VmPlacementPolicyProperties. - - 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 type: Required. placement policy type.Constant filled by server. Possible values - include: "VmVm", "VmHost". - :type type: str or ~azure.mgmt.avs.models.PlacementPolicyType - :param state: Whether the placement policy is enabled or disabled. Possible values include: - "Enabled", "Disabled". - :type state: str or ~azure.mgmt.avs.models.PlacementPolicyState - :param display_name: Display name of the placement policy. - :type display_name: str - :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", - "Failed", "Building", "Deleting", "Updating". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.PlacementPolicyProvisioningState - """ - - _validation = { - 'type': {'required': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'VmHost': 'VmHostPlacementPolicyProperties', 'VmVm': 'VmPlacementPolicyProperties'} - } - - def __init__( - self, - **kwargs - ): - super(PlacementPolicyProperties, self).__init__(**kwargs) - self.type = None # type: Optional[str] - self.state = kwargs.get('state', None) - self.display_name = kwargs.get('display_name', None) - self.provisioning_state = None - - -class PlacementPolicyUpdate(msrest.serialization.Model): - """An update of a DRS placement policy resource. - - :param state: Whether the placement policy is enabled or disabled. Possible values include: - "Enabled", "Disabled". - :type state: str or ~azure.mgmt.avs.models.PlacementPolicyState - :param vm_members: Virtual machine members list. - :type vm_members: list[str] - :param host_members: Host members list. - :type host_members: list[str] - """ - - _attribute_map = { - 'state': {'key': 'properties.state', 'type': 'str'}, - 'vm_members': {'key': 'properties.vmMembers', 'type': '[str]'}, - 'host_members': {'key': 'properties.hostMembers', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PlacementPolicyUpdate, self).__init__(**kwargs) - self.state = kwargs.get('state', None) - self.vm_members = kwargs.get('vm_members', None) - self.host_members = kwargs.get('host_members', None) - - -class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - - -class PrivateCloud(TrackedResource): - """A private cloud resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: Required. The private cloud SKU. - :type sku: ~azure.mgmt.avs.models.Sku - :param identity: The identity of the private cloud, if configured. - :type identity: ~azure.mgmt.avs.models.PrivateCloudIdentity - :param management_cluster: The default cluster used for management. - :type management_cluster: ~azure.mgmt.avs.models.ManagementCluster - :param internet: Connectivity to internet is enabled or disabled. Possible values include: - "Enabled", "Disabled". Default value: "Disabled". - :type internet: str or ~azure.mgmt.avs.models.InternetEnum - :param identity_sources: vCenter Single Sign On Identity Sources. - :type identity_sources: list[~azure.mgmt.avs.models.IdentitySource] - :param availability: Properties describing how the cloud is distributed across availability - zones. - :type availability: ~azure.mgmt.avs.models.AvailabilityProperties - :param encryption: Customer managed key encryption, can be enabled or disabled. - :type encryption: ~azure.mgmt.avs.models.Encryption - :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", - "Failed", "Cancelled", "Pending", "Building", "Deleting", "Updating". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.PrivateCloudProvisioningState - :param circuit: An ExpressRoute Circuit. - :type circuit: ~azure.mgmt.avs.models.Circuit - :ivar endpoints: The endpoints. - :vartype endpoints: ~azure.mgmt.avs.models.Endpoints - :param network_block: The block of addresses should be unique across VNet in your subscription - as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where A,B,C,D are - between 0 and 255, and X is between 0 and 22. - :type network_block: str - :ivar management_network: Network used to access vCenter Server and NSX-T Manager. - :vartype management_network: str - :ivar provisioning_network: Used for virtual machine cold migration, cloning, and snapshot - migration. - :vartype provisioning_network: str - :ivar vmotion_network: Used for live migration of virtual machines. - :vartype vmotion_network: str - :param vcenter_password: Optionally, set the vCenter admin password when the private cloud is - created. - :type vcenter_password: str - :param nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is - created. - :type nsxt_password: str - :ivar vcenter_certificate_thumbprint: Thumbprint of the vCenter Server SSL certificate. - :vartype vcenter_certificate_thumbprint: str - :ivar nsxt_certificate_thumbprint: Thumbprint of the NSX-T Manager SSL certificate. - :vartype nsxt_certificate_thumbprint: str - :ivar external_cloud_links: Array of cloud link IDs from other clouds that connect to this one. - :vartype external_cloud_links: list[str] - :param secondary_circuit: A secondary expressRoute circuit from a separate AZ. Only present in - a stretched private cloud. - :type secondary_circuit: ~azure.mgmt.avs.models.Circuit - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'sku': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'endpoints': {'readonly': True}, - 'management_network': {'readonly': True}, - 'provisioning_network': {'readonly': True}, - 'vmotion_network': {'readonly': True}, - 'vcenter_certificate_thumbprint': {'readonly': True}, - 'nsxt_certificate_thumbprint': {'readonly': True}, - 'external_cloud_links': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'identity': {'key': 'identity', 'type': 'PrivateCloudIdentity'}, - 'management_cluster': {'key': 'properties.managementCluster', 'type': 'ManagementCluster'}, - 'internet': {'key': 'properties.internet', 'type': 'str'}, - 'identity_sources': {'key': 'properties.identitySources', 'type': '[IdentitySource]'}, - 'availability': {'key': 'properties.availability', 'type': 'AvailabilityProperties'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'circuit': {'key': 'properties.circuit', 'type': 'Circuit'}, - 'endpoints': {'key': 'properties.endpoints', 'type': 'Endpoints'}, - 'network_block': {'key': 'properties.networkBlock', 'type': 'str'}, - 'management_network': {'key': 'properties.managementNetwork', 'type': 'str'}, - 'provisioning_network': {'key': 'properties.provisioningNetwork', 'type': 'str'}, - 'vmotion_network': {'key': 'properties.vmotionNetwork', 'type': 'str'}, - 'vcenter_password': {'key': 'properties.vcenterPassword', 'type': 'str'}, - 'nsxt_password': {'key': 'properties.nsxtPassword', 'type': 'str'}, - 'vcenter_certificate_thumbprint': {'key': 'properties.vcenterCertificateThumbprint', 'type': 'str'}, - 'nsxt_certificate_thumbprint': {'key': 'properties.nsxtCertificateThumbprint', 'type': 'str'}, - 'external_cloud_links': {'key': 'properties.externalCloudLinks', 'type': '[str]'}, - 'secondary_circuit': {'key': 'properties.secondaryCircuit', 'type': 'Circuit'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateCloud, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.identity = kwargs.get('identity', None) - self.management_cluster = kwargs.get('management_cluster', None) - self.internet = kwargs.get('internet', "Disabled") - self.identity_sources = kwargs.get('identity_sources', None) - self.availability = kwargs.get('availability', None) - self.encryption = kwargs.get('encryption', None) - self.provisioning_state = None - self.circuit = kwargs.get('circuit', None) - self.endpoints = None - self.network_block = kwargs.get('network_block', None) - self.management_network = None - self.provisioning_network = None - self.vmotion_network = None - self.vcenter_password = kwargs.get('vcenter_password', None) - self.nsxt_password = kwargs.get('nsxt_password', None) - self.vcenter_certificate_thumbprint = None - self.nsxt_certificate_thumbprint = None - self.external_cloud_links = None - self.secondary_circuit = kwargs.get('secondary_circuit', None) - - -class PrivateCloudIdentity(msrest.serialization.Model): - """Identity for the virtual machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of private cloud identity. This property will only be - provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID associated with the private cloud. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :param type: The type of identity used for the private cloud. The type 'SystemAssigned' refers - to an implicitly created identity. The type 'None' will remove any identities from the Private - Cloud. Possible values include: "SystemAssigned", "None". - :type type: str or ~azure.mgmt.avs.models.ResourceIdentityType - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateCloudIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class PrivateCloudList(msrest.serialization.Model): - """A paged list of private clouds. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The items on the page. - :vartype value: list[~azure.mgmt.avs.models.PrivateCloud] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateCloud]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateCloudList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class PrivateCloudUpdateProperties(msrest.serialization.Model): - """The properties of a private cloud resource that may be updated. - - :param management_cluster: The default cluster used for management. - :type management_cluster: ~azure.mgmt.avs.models.ManagementCluster - :param internet: Connectivity to internet is enabled or disabled. Possible values include: - "Enabled", "Disabled". Default value: "Disabled". - :type internet: str or ~azure.mgmt.avs.models.InternetEnum - :param identity_sources: vCenter Single Sign On Identity Sources. - :type identity_sources: list[~azure.mgmt.avs.models.IdentitySource] - :param availability: Properties describing how the cloud is distributed across availability - zones. - :type availability: ~azure.mgmt.avs.models.AvailabilityProperties - :param encryption: Customer managed key encryption, can be enabled or disabled. - :type encryption: ~azure.mgmt.avs.models.Encryption - """ - - _attribute_map = { - 'management_cluster': {'key': 'managementCluster', 'type': 'ManagementCluster'}, - 'internet': {'key': 'internet', 'type': 'str'}, - 'identity_sources': {'key': 'identitySources', 'type': '[IdentitySource]'}, - 'availability': {'key': 'availability', 'type': 'AvailabilityProperties'}, - 'encryption': {'key': 'encryption', 'type': 'Encryption'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateCloudUpdateProperties, self).__init__(**kwargs) - self.management_cluster = kwargs.get('management_cluster', None) - self.internet = kwargs.get('internet', "Disabled") - self.identity_sources = kwargs.get('identity_sources', None) - self.availability = kwargs.get('availability', None) - self.encryption = kwargs.get('encryption', None) - - -class PrivateCloudProperties(PrivateCloudUpdateProperties): - """The properties of a private cloud resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param management_cluster: The default cluster used for management. - :type management_cluster: ~azure.mgmt.avs.models.ManagementCluster - :param internet: Connectivity to internet is enabled or disabled. Possible values include: - "Enabled", "Disabled". Default value: "Disabled". - :type internet: str or ~azure.mgmt.avs.models.InternetEnum - :param identity_sources: vCenter Single Sign On Identity Sources. - :type identity_sources: list[~azure.mgmt.avs.models.IdentitySource] - :param availability: Properties describing how the cloud is distributed across availability - zones. - :type availability: ~azure.mgmt.avs.models.AvailabilityProperties - :param encryption: Customer managed key encryption, can be enabled or disabled. - :type encryption: ~azure.mgmt.avs.models.Encryption - :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", - "Failed", "Cancelled", "Pending", "Building", "Deleting", "Updating". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.PrivateCloudProvisioningState - :param circuit: An ExpressRoute Circuit. - :type circuit: ~azure.mgmt.avs.models.Circuit - :ivar endpoints: The endpoints. - :vartype endpoints: ~azure.mgmt.avs.models.Endpoints - :param network_block: Required. The block of addresses should be unique across VNet in your - subscription as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where - A,B,C,D are between 0 and 255, and X is between 0 and 22. - :type network_block: str - :ivar management_network: Network used to access vCenter Server and NSX-T Manager. - :vartype management_network: str - :ivar provisioning_network: Used for virtual machine cold migration, cloning, and snapshot - migration. - :vartype provisioning_network: str - :ivar vmotion_network: Used for live migration of virtual machines. - :vartype vmotion_network: str - :param vcenter_password: Optionally, set the vCenter admin password when the private cloud is - created. - :type vcenter_password: str - :param nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is - created. - :type nsxt_password: str - :ivar vcenter_certificate_thumbprint: Thumbprint of the vCenter Server SSL certificate. - :vartype vcenter_certificate_thumbprint: str - :ivar nsxt_certificate_thumbprint: Thumbprint of the NSX-T Manager SSL certificate. - :vartype nsxt_certificate_thumbprint: str - :ivar external_cloud_links: Array of cloud link IDs from other clouds that connect to this one. - :vartype external_cloud_links: list[str] - :param secondary_circuit: A secondary expressRoute circuit from a separate AZ. Only present in - a stretched private cloud. - :type secondary_circuit: ~azure.mgmt.avs.models.Circuit - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'endpoints': {'readonly': True}, - 'network_block': {'required': True}, - 'management_network': {'readonly': True}, - 'provisioning_network': {'readonly': True}, - 'vmotion_network': {'readonly': True}, - 'vcenter_certificate_thumbprint': {'readonly': True}, - 'nsxt_certificate_thumbprint': {'readonly': True}, - 'external_cloud_links': {'readonly': True}, - } - - _attribute_map = { - 'management_cluster': {'key': 'managementCluster', 'type': 'ManagementCluster'}, - 'internet': {'key': 'internet', 'type': 'str'}, - 'identity_sources': {'key': 'identitySources', 'type': '[IdentitySource]'}, - 'availability': {'key': 'availability', 'type': 'AvailabilityProperties'}, - 'encryption': {'key': 'encryption', 'type': 'Encryption'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'circuit': {'key': 'circuit', 'type': 'Circuit'}, - 'endpoints': {'key': 'endpoints', 'type': 'Endpoints'}, - 'network_block': {'key': 'networkBlock', 'type': 'str'}, - 'management_network': {'key': 'managementNetwork', 'type': 'str'}, - 'provisioning_network': {'key': 'provisioningNetwork', 'type': 'str'}, - 'vmotion_network': {'key': 'vmotionNetwork', 'type': 'str'}, - 'vcenter_password': {'key': 'vcenterPassword', 'type': 'str'}, - 'nsxt_password': {'key': 'nsxtPassword', 'type': 'str'}, - 'vcenter_certificate_thumbprint': {'key': 'vcenterCertificateThumbprint', 'type': 'str'}, - 'nsxt_certificate_thumbprint': {'key': 'nsxtCertificateThumbprint', 'type': 'str'}, - 'external_cloud_links': {'key': 'externalCloudLinks', 'type': '[str]'}, - 'secondary_circuit': {'key': 'secondaryCircuit', 'type': 'Circuit'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateCloudProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.circuit = kwargs.get('circuit', None) - self.endpoints = None - self.network_block = kwargs['network_block'] - self.management_network = None - self.provisioning_network = None - self.vmotion_network = None - self.vcenter_password = kwargs.get('vcenter_password', None) - self.nsxt_password = kwargs.get('nsxt_password', None) - self.vcenter_certificate_thumbprint = None - self.nsxt_certificate_thumbprint = None - self.external_cloud_links = None - self.secondary_circuit = kwargs.get('secondary_circuit', None) - - -class PrivateCloudUpdate(msrest.serialization.Model): - """An update to a private cloud resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: The identity of the private cloud, if configured. - :type identity: ~azure.mgmt.avs.models.PrivateCloudIdentity - :param management_cluster: The default cluster used for management. - :type management_cluster: ~azure.mgmt.avs.models.ManagementCluster - :param internet: Connectivity to internet is enabled or disabled. Possible values include: - "Enabled", "Disabled". Default value: "Disabled". - :type internet: str or ~azure.mgmt.avs.models.InternetEnum - :param identity_sources: vCenter Single Sign On Identity Sources. - :type identity_sources: list[~azure.mgmt.avs.models.IdentitySource] - :param availability: Properties describing how the cloud is distributed across availability - zones. - :type availability: ~azure.mgmt.avs.models.AvailabilityProperties - :param encryption: Customer managed key encryption, can be enabled or disabled. - :type encryption: ~azure.mgmt.avs.models.Encryption - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'PrivateCloudIdentity'}, - 'management_cluster': {'key': 'properties.managementCluster', 'type': 'ManagementCluster'}, - 'internet': {'key': 'properties.internet', 'type': 'str'}, - 'identity_sources': {'key': 'properties.identitySources', 'type': '[IdentitySource]'}, - 'availability': {'key': 'properties.availability', 'type': 'AvailabilityProperties'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateCloudUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.management_cluster = kwargs.get('management_cluster', None) - self.internet = kwargs.get('internet', "Disabled") - self.identity_sources = kwargs.get('identity_sources', None) - self.availability = kwargs.get('availability', None) - self.encryption = kwargs.get('encryption', None) - - -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class ScriptExecutionParameter(msrest.serialization.Model): - """The arguments passed in to the execution. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: PSCredentialExecutionParameter, ScriptSecureStringExecutionParameter, ScriptStringExecutionParameter. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The parameter name. - :type name: str - :param type: Required. The type of execution parameter.Constant filled by server. Possible - values include: "Value", "SecureValue", "Credential". - :type type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Credential': 'PSCredentialExecutionParameter', 'SecureValue': 'ScriptSecureStringExecutionParameter', 'Value': 'ScriptStringExecutionParameter'} - } - - def __init__( - self, - **kwargs - ): - super(ScriptExecutionParameter, self).__init__(**kwargs) - self.name = kwargs['name'] - self.type = None # type: Optional[str] - - -class PSCredentialExecutionParameter(ScriptExecutionParameter): - """a powershell credential object. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The parameter name. - :type name: str - :param type: Required. The type of execution parameter.Constant filled by server. Possible - values include: "Value", "SecureValue", "Credential". - :type type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType - :param username: username for login. - :type username: str - :param password: password for login. - :type password: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PSCredentialExecutionParameter, self).__init__(**kwargs) - self.type = 'Credential' # type: str - self.username = kwargs.get('username', None) - self.password = kwargs.get('password', None) - - -class Quota(msrest.serialization.Model): - """Subscription quotas. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar hosts_remaining: Remaining hosts quota by sku type. - :vartype hosts_remaining: dict[str, int] - :ivar quota_enabled: Host quota is active for current subscription. Possible values include: - "Enabled", "Disabled". - :vartype quota_enabled: str or ~azure.mgmt.avs.models.QuotaEnabled - """ - - _validation = { - 'hosts_remaining': {'readonly': True}, - 'quota_enabled': {'readonly': True}, - } - - _attribute_map = { - 'hosts_remaining': {'key': 'hostsRemaining', 'type': '{int}'}, - 'quota_enabled': {'key': 'quotaEnabled', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Quota, self).__init__(**kwargs) - self.hosts_remaining = None - self.quota_enabled = None - - -class ScriptCmdlet(ProxyResource): - """A cmdlet available for script execution. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar description: Description of the scripts functionality. - :vartype description: str - :ivar timeout: Recommended time limit for execution. - :vartype timeout: str - :ivar parameters: Parameters the script will accept. - :vartype parameters: list[~azure.mgmt.avs.models.ScriptParameter] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'description': {'readonly': True}, - 'timeout': {'readonly': True}, - 'parameters': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'timeout': {'key': 'properties.timeout', 'type': 'str'}, - 'parameters': {'key': 'properties.parameters', 'type': '[ScriptParameter]'}, - } - - def __init__( - self, - **kwargs - ): - super(ScriptCmdlet, self).__init__(**kwargs) - self.description = None - self.timeout = None - self.parameters = None - - -class ScriptCmdletsList(msrest.serialization.Model): - """Pageable list of scripts/cmdlets. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of scripts. - :vartype value: list[~azure.mgmt.avs.models.ScriptCmdlet] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ScriptCmdlet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScriptCmdletsList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ScriptExecution(ProxyResource): - """An instance of a script executed by a user - custom or AVS. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param script_cmdlet_id: A reference to the script cmdlet resource if user is running a AVS - script. - :type script_cmdlet_id: str - :param parameters: Parameters the script will accept. - :type parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter] - :param hidden_parameters: Parameters that will be hidden/not visible to ARM, such as passwords - and credentials. - :type hidden_parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter] - :param failure_reason: Error message if the script was able to run, but if the script itself - had errors or powershell threw an exception. - :type failure_reason: str - :param timeout: Time limit for execution. - :type timeout: str - :param retention: Time to live for the resource. If not provided, will be available for 60 - days. - :type retention: str - :ivar submitted_at: Time the script execution was submitted. - :vartype submitted_at: ~datetime.datetime - :ivar started_at: Time the script execution was started. - :vartype started_at: ~datetime.datetime - :ivar finished_at: Time the script execution was finished. - :vartype finished_at: ~datetime.datetime - :ivar provisioning_state: The state of the script execution resource. Possible values include: - "Pending", "Running", "Succeeded", "Failed", "Cancelling", "Cancelled", "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.ScriptExecutionProvisioningState - :param output: Standard output stream from the powershell execution. - :type output: list[str] - :param named_outputs: User-defined dictionary. - :type named_outputs: dict[str, any] - :ivar information: Standard information out stream from the powershell execution. - :vartype information: list[str] - :ivar warnings: Standard warning out stream from the powershell execution. - :vartype warnings: list[str] - :ivar errors: Standard error output stream from the powershell execution. - :vartype errors: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'submitted_at': {'readonly': True}, - 'started_at': {'readonly': True}, - 'finished_at': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'information': {'readonly': True}, - 'warnings': {'readonly': True}, - 'errors': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'script_cmdlet_id': {'key': 'properties.scriptCmdletId', 'type': 'str'}, - 'parameters': {'key': 'properties.parameters', 'type': '[ScriptExecutionParameter]'}, - 'hidden_parameters': {'key': 'properties.hiddenParameters', 'type': '[ScriptExecutionParameter]'}, - 'failure_reason': {'key': 'properties.failureReason', 'type': 'str'}, - 'timeout': {'key': 'properties.timeout', 'type': 'str'}, - 'retention': {'key': 'properties.retention', 'type': 'str'}, - 'submitted_at': {'key': 'properties.submittedAt', 'type': 'iso-8601'}, - 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, - 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'output': {'key': 'properties.output', 'type': '[str]'}, - 'named_outputs': {'key': 'properties.namedOutputs', 'type': '{object}'}, - 'information': {'key': 'properties.information', 'type': '[str]'}, - 'warnings': {'key': 'properties.warnings', 'type': '[str]'}, - 'errors': {'key': 'properties.errors', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ScriptExecution, self).__init__(**kwargs) - self.script_cmdlet_id = kwargs.get('script_cmdlet_id', None) - self.parameters = kwargs.get('parameters', None) - self.hidden_parameters = kwargs.get('hidden_parameters', None) - self.failure_reason = kwargs.get('failure_reason', None) - self.timeout = kwargs.get('timeout', None) - self.retention = kwargs.get('retention', None) - self.submitted_at = None - self.started_at = None - self.finished_at = None - self.provisioning_state = None - self.output = kwargs.get('output', None) - self.named_outputs = kwargs.get('named_outputs', None) - self.information = None - self.warnings = None - self.errors = None - - -class ScriptExecutionsList(msrest.serialization.Model): - """Pageable list of script executions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of scripts. - :vartype value: list[~azure.mgmt.avs.models.ScriptExecution] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ScriptExecution]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScriptExecutionsList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ScriptPackage(ProxyResource): - """Script Package resources available for execution. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar description: User friendly description of the package. - :vartype description: str - :ivar version: Module version. - :vartype version: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'description': {'readonly': True}, - 'version': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScriptPackage, self).__init__(**kwargs) - self.description = None - self.version = None - - -class ScriptPackagesList(msrest.serialization.Model): - """A list of the available script packages. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of script package resources. - :vartype value: list[~azure.mgmt.avs.models.ScriptPackage] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ScriptPackage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScriptPackagesList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ScriptParameter(msrest.serialization.Model): - """An parameter that the script will accept. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of parameter the script is expecting. psCredential is a - PSCredentialObject. Possible values include: "String", "SecureString", "Credential", "Int", - "Bool", "Float". - :vartype type: str or ~azure.mgmt.avs.models.ScriptParameterTypes - :param name: The parameter name that the script will expect a parameter value for. - :type name: str - :ivar description: User friendly description of the parameter. - :vartype description: str - :ivar visibility: Should this parameter be visible to arm and passed in the parameters argument - when executing. Possible values include: "Visible", "Hidden". - :vartype visibility: str or ~azure.mgmt.avs.models.VisibilityParameterEnum - :ivar optional: Is this parameter required or optional. Possible values include: "Optional", - "Required". - :vartype optional: str or ~azure.mgmt.avs.models.OptionalParamEnum - """ - - _validation = { - 'type': {'readonly': True}, - 'description': {'readonly': True}, - 'visibility': {'readonly': True}, - 'optional': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'visibility': {'key': 'visibility', 'type': 'str'}, - 'optional': {'key': 'optional', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScriptParameter, self).__init__(**kwargs) - self.type = None - self.name = kwargs.get('name', None) - self.description = None - self.visibility = None - self.optional = None - - -class ScriptSecureStringExecutionParameter(ScriptExecutionParameter): - """a plain text value execution parameter. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The parameter name. - :type name: str - :param type: Required. The type of execution parameter.Constant filled by server. Possible - values include: "Value", "SecureValue", "Credential". - :type type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType - :param secure_value: A secure value for the passed parameter, not to be stored in logs. - :type secure_value: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'secure_value': {'key': 'secureValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScriptSecureStringExecutionParameter, self).__init__(**kwargs) - self.type = 'SecureValue' # type: str - self.secure_value = kwargs.get('secure_value', None) - - -class ScriptStringExecutionParameter(ScriptExecutionParameter): - """a plain text value execution parameter. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The parameter name. - :type name: str - :param type: Required. The type of execution parameter.Constant filled by server. Possible - values include: "Value", "SecureValue", "Credential". - :type type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType - :param value: The value for the passed parameter. - :type value: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScriptStringExecutionParameter, self).__init__(**kwargs) - self.type = 'Value' # type: str - self.value = kwargs.get('value', None) - - -class ServiceSpecification(msrest.serialization.Model): - """Service specification payload. - - :param log_specifications: Specifications of the Log for Azure Monitoring. - :type log_specifications: list[~azure.mgmt.avs.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure Monitoring. - :type metric_specifications: list[~azure.mgmt.avs.models.MetricSpecification] - """ - - _attribute_map = { - 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.log_specifications = kwargs.get('log_specifications', None) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Sku(msrest.serialization.Model): - """The resource model definition representing SKU. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the SKU. - :type name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class Trial(msrest.serialization.Model): - """Subscription trial availability. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: Trial status. Possible values include: "TrialAvailable", "TrialUsed", - "TrialDisabled". - :vartype status: str or ~azure.mgmt.avs.models.TrialStatus - :ivar available_hosts: Number of trial hosts available. - :vartype available_hosts: int - """ - - _validation = { - 'status': {'readonly': True}, - 'available_hosts': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'available_hosts': {'key': 'availableHosts', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(Trial, self).__init__(**kwargs) - self.status = None - self.available_hosts = None - - -class VirtualMachine(ProxyResource): - """Virtual Machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar display_name: Display name of the VM. - :vartype display_name: str - :ivar mo_ref_id: Virtual machine managed object reference id. - :vartype mo_ref_id: str - :ivar folder_path: Path to virtual machine's folder starting from datacenter virtual machine - folder. - :vartype folder_path: str - :ivar restrict_movement: Whether VM DRS-driven movement is restricted (enabled) or not - (disabled). Possible values include: "Enabled", "Disabled". - :vartype restrict_movement: str or ~azure.mgmt.avs.models.VirtualMachineRestrictMovementState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'display_name': {'readonly': True}, - 'mo_ref_id': {'readonly': True}, - 'folder_path': {'readonly': True}, - 'restrict_movement': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'mo_ref_id': {'key': 'properties.moRefId', 'type': 'str'}, - 'folder_path': {'key': 'properties.folderPath', 'type': 'str'}, - 'restrict_movement': {'key': 'properties.restrictMovement', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachine, self).__init__(**kwargs) - self.display_name = None - self.mo_ref_id = None - self.folder_path = None - self.restrict_movement = None - - -class VirtualMachineRestrictMovement(msrest.serialization.Model): - """Set VM DRS-driven movement to restricted (enabled) or not (disabled). - - :param restrict_movement: Whether VM DRS-driven movement is restricted (enabled) or not - (disabled). Possible values include: "Enabled", "Disabled". - :type restrict_movement: str or ~azure.mgmt.avs.models.VirtualMachineRestrictMovementState - """ - - _attribute_map = { - 'restrict_movement': {'key': 'restrictMovement', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineRestrictMovement, self).__init__(**kwargs) - self.restrict_movement = kwargs.get('restrict_movement', None) - - -class VirtualMachinesList(msrest.serialization.Model): - """A list of Virtual Machines. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The items to be displayed on the page. - :vartype value: list[~azure.mgmt.avs.models.VirtualMachine] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualMachine]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachinesList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class VmHostPlacementPolicyProperties(PlacementPolicyProperties): - """VM-Host placement policy properties. - - 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 type: Required. placement policy type.Constant filled by server. Possible values - include: "VmVm", "VmHost". - :type type: str or ~azure.mgmt.avs.models.PlacementPolicyType - :param state: Whether the placement policy is enabled or disabled. Possible values include: - "Enabled", "Disabled". - :type state: str or ~azure.mgmt.avs.models.PlacementPolicyState - :param display_name: Display name of the placement policy. - :type display_name: str - :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", - "Failed", "Building", "Deleting", "Updating". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.PlacementPolicyProvisioningState - :param vm_members: Required. Virtual machine members list. - :type vm_members: list[str] - :param host_members: Required. Host members list. - :type host_members: list[str] - :param affinity_type: Required. placement policy affinity type. Possible values include: - "Affinity", "AntiAffinity". - :type affinity_type: str or ~azure.mgmt.avs.models.AffinityType - """ - - _validation = { - 'type': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'vm_members': {'required': True}, - 'host_members': {'required': True}, - 'affinity_type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'vm_members': {'key': 'vmMembers', 'type': '[str]'}, - 'host_members': {'key': 'hostMembers', 'type': '[str]'}, - 'affinity_type': {'key': 'affinityType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VmHostPlacementPolicyProperties, self).__init__(**kwargs) - self.type = 'VmHost' # type: str - self.vm_members = kwargs['vm_members'] - self.host_members = kwargs['host_members'] - self.affinity_type = kwargs['affinity_type'] - - -class VmPlacementPolicyProperties(PlacementPolicyProperties): - """VM-VM placement policy properties. - - 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 type: Required. placement policy type.Constant filled by server. Possible values - include: "VmVm", "VmHost". - :type type: str or ~azure.mgmt.avs.models.PlacementPolicyType - :param state: Whether the placement policy is enabled or disabled. Possible values include: - "Enabled", "Disabled". - :type state: str or ~azure.mgmt.avs.models.PlacementPolicyState - :param display_name: Display name of the placement policy. - :type display_name: str - :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", - "Failed", "Building", "Deleting", "Updating". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.PlacementPolicyProvisioningState - :param vm_members: Required. Virtual machine members list. - :type vm_members: list[str] - :param affinity_type: Required. placement policy affinity type. Possible values include: - "Affinity", "AntiAffinity". - :type affinity_type: str or ~azure.mgmt.avs.models.AffinityType - """ - - _validation = { - 'type': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'vm_members': {'required': True}, - 'affinity_type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'vm_members': {'key': 'vmMembers', 'type': '[str]'}, - 'affinity_type': {'key': 'affinityType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VmPlacementPolicyProperties, self).__init__(**kwargs) - self.type = 'VmVm' # type: str - self.vm_members = kwargs['vm_members'] - self.affinity_type = kwargs['affinity_type'] - - -class WorkloadNetworkDhcp(ProxyResource): - """NSX DHCP. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param properties: DHCP properties. - :type properties: ~azure.mgmt.avs.models.WorkloadNetworkDhcpEntity - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'WorkloadNetworkDhcpEntity'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkDhcp, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class WorkloadNetworkDhcpEntity(msrest.serialization.Model): - """Base class for WorkloadNetworkDhcpServer and WorkloadNetworkDhcpRelay to inherit from. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: WorkloadNetworkDhcpRelay, WorkloadNetworkDhcpServer. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param dhcp_type: Required. Type of DHCP: SERVER or RELAY.Constant filled by server. Possible - values include: "SERVER", "RELAY". - :type dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum - :param display_name: Display name of the DHCP entity. - :type display_name: str - :ivar segments: NSX Segments consuming DHCP. - :vartype segments: list[str] - :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", - "Failed", "Building", "Deleting", "Updating". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState - :param revision: NSX revision number. - :type revision: long - """ - - _validation = { - 'dhcp_type': {'required': True}, - 'segments': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'dhcp_type': {'key': 'dhcpType', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'segments': {'key': 'segments', 'type': '[str]'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'revision': {'key': 'revision', 'type': 'long'}, - } - - _subtype_map = { - 'dhcp_type': {'RELAY': 'WorkloadNetworkDhcpRelay', 'SERVER': 'WorkloadNetworkDhcpServer'} - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkDhcpEntity, self).__init__(**kwargs) - self.dhcp_type = None # type: Optional[str] - self.display_name = kwargs.get('display_name', None) - self.segments = None - self.provisioning_state = None - self.revision = kwargs.get('revision', None) - - -class WorkloadNetworkDhcpList(msrest.serialization.Model): - """A list of NSX dhcp entities. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The items on the page. - :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkDhcp] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[WorkloadNetworkDhcp]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkDhcpList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class WorkloadNetworkDhcpRelay(WorkloadNetworkDhcpEntity): - """NSX DHCP Relay. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param dhcp_type: Required. Type of DHCP: SERVER or RELAY.Constant filled by server. Possible - values include: "SERVER", "RELAY". - :type dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum - :param display_name: Display name of the DHCP entity. - :type display_name: str - :ivar segments: NSX Segments consuming DHCP. - :vartype segments: list[str] - :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", - "Failed", "Building", "Deleting", "Updating". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState - :param revision: NSX revision number. - :type revision: long - :param server_addresses: DHCP Relay Addresses. Max 3. - :type server_addresses: list[str] - """ - - _validation = { - 'dhcp_type': {'required': True}, - 'segments': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'server_addresses': {'max_items': 3, 'min_items': 1}, - } - - _attribute_map = { - 'dhcp_type': {'key': 'dhcpType', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'segments': {'key': 'segments', 'type': '[str]'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'revision': {'key': 'revision', 'type': 'long'}, - 'server_addresses': {'key': 'serverAddresses', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkDhcpRelay, self).__init__(**kwargs) - self.dhcp_type = 'RELAY' # type: str - self.server_addresses = kwargs.get('server_addresses', None) - - -class WorkloadNetworkDhcpServer(WorkloadNetworkDhcpEntity): - """NSX DHCP Server. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param dhcp_type: Required. Type of DHCP: SERVER or RELAY.Constant filled by server. Possible - values include: "SERVER", "RELAY". - :type dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum - :param display_name: Display name of the DHCP entity. - :type display_name: str - :ivar segments: NSX Segments consuming DHCP. - :vartype segments: list[str] - :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", - "Failed", "Building", "Deleting", "Updating". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState - :param revision: NSX revision number. - :type revision: long - :param server_address: DHCP Server Address. - :type server_address: str - :param lease_time: DHCP Server Lease Time. - :type lease_time: long - """ - - _validation = { - 'dhcp_type': {'required': True}, - 'segments': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'dhcp_type': {'key': 'dhcpType', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'segments': {'key': 'segments', 'type': '[str]'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'revision': {'key': 'revision', 'type': 'long'}, - 'server_address': {'key': 'serverAddress', 'type': 'str'}, - 'lease_time': {'key': 'leaseTime', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkDhcpServer, self).__init__(**kwargs) - self.dhcp_type = 'SERVER' # type: str - self.server_address = kwargs.get('server_address', None) - self.lease_time = kwargs.get('lease_time', None) - - -class WorkloadNetworkDnsService(ProxyResource): - """NSX DNS Service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param display_name: Display name of the DNS Service. - :type display_name: str - :param dns_service_ip: DNS service IP of the DNS Service. - :type dns_service_ip: str - :param default_dns_zone: Default DNS zone of the DNS Service. - :type default_dns_zone: str - :param fqdn_zones: FQDN zones of the DNS Service. - :type fqdn_zones: list[str] - :param log_level: DNS Service log level. Possible values include: "DEBUG", "INFO", "WARNING", - "ERROR", "FATAL". - :type log_level: str or ~azure.mgmt.avs.models.DnsServiceLogLevelEnum - :ivar status: DNS Service status. Possible values include: "SUCCESS", "FAILURE". - :vartype status: str or ~azure.mgmt.avs.models.DnsServiceStatusEnum - :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", - "Failed", "Building", "Deleting", "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.avs.models.WorkloadNetworkDnsServiceProvisioningState - :param revision: NSX revision number. - :type revision: long - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'status': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'dns_service_ip': {'key': 'properties.dnsServiceIp', 'type': 'str'}, - 'default_dns_zone': {'key': 'properties.defaultDnsZone', 'type': 'str'}, - 'fqdn_zones': {'key': 'properties.fqdnZones', 'type': '[str]'}, - 'log_level': {'key': 'properties.logLevel', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'revision': {'key': 'properties.revision', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkDnsService, self).__init__(**kwargs) - self.display_name = kwargs.get('display_name', None) - self.dns_service_ip = kwargs.get('dns_service_ip', None) - self.default_dns_zone = kwargs.get('default_dns_zone', None) - self.fqdn_zones = kwargs.get('fqdn_zones', None) - self.log_level = kwargs.get('log_level', None) - self.status = None - self.provisioning_state = None - self.revision = kwargs.get('revision', None) - - -class WorkloadNetworkDnsServicesList(msrest.serialization.Model): - """A list of NSX DNS Services. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The items on the page. - :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkDnsService] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[WorkloadNetworkDnsService]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkDnsServicesList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class WorkloadNetworkDnsZone(ProxyResource): - """NSX DNS Zone. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param display_name: Display name of the DNS Zone. - :type display_name: str - :param domain: Domain names of the DNS Zone. - :type domain: list[str] - :param dns_server_ips: DNS Server IP array of the DNS Zone. - :type dns_server_ips: list[str] - :param source_ip: Source IP of the DNS Zone. - :type source_ip: str - :param dns_services: Number of DNS Services using the DNS zone. - :type dns_services: long - :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", - "Failed", "Building", "Deleting", "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.avs.models.WorkloadNetworkDnsZoneProvisioningState - :param revision: NSX revision number. - :type revision: long - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'domain': {'key': 'properties.domain', 'type': '[str]'}, - 'dns_server_ips': {'key': 'properties.dnsServerIps', 'type': '[str]'}, - 'source_ip': {'key': 'properties.sourceIp', 'type': 'str'}, - 'dns_services': {'key': 'properties.dnsServices', 'type': 'long'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'revision': {'key': 'properties.revision', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkDnsZone, self).__init__(**kwargs) - self.display_name = kwargs.get('display_name', None) - self.domain = kwargs.get('domain', None) - self.dns_server_ips = kwargs.get('dns_server_ips', None) - self.source_ip = kwargs.get('source_ip', None) - self.dns_services = kwargs.get('dns_services', None) - self.provisioning_state = None - self.revision = kwargs.get('revision', None) - - -class WorkloadNetworkDnsZonesList(msrest.serialization.Model): - """A list of NSX DNS Zones. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The items on the page. - :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[WorkloadNetworkDnsZone]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkDnsZonesList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class WorkloadNetworkGateway(ProxyResource): - """NSX Gateway. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param display_name: Display name of the DHCP entity. - :type display_name: str - :ivar path: NSX Gateway Path. - :vartype path: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'path': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'path': {'key': 'properties.path', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkGateway, self).__init__(**kwargs) - self.display_name = kwargs.get('display_name', None) - self.path = None - - -class WorkloadNetworkGatewayList(msrest.serialization.Model): - """A list of NSX Gateways. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The items on the page. - :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkGateway] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[WorkloadNetworkGateway]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkGatewayList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class WorkloadNetworkPortMirroring(ProxyResource): - """NSX Port Mirroring. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param display_name: Display name of the port mirroring profile. - :type display_name: str - :param direction: Direction of port mirroring profile. Possible values include: "INGRESS", - "EGRESS", "BIDIRECTIONAL". - :type direction: str or ~azure.mgmt.avs.models.PortMirroringDirectionEnum - :param source: Source VM Group. - :type source: str - :param destination: Destination VM Group. - :type destination: str - :ivar status: Port Mirroring Status. Possible values include: "SUCCESS", "FAILURE". - :vartype status: str or ~azure.mgmt.avs.models.PortMirroringStatusEnum - :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", - "Failed", "Building", "Deleting", "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.avs.models.WorkloadNetworkPortMirroringProvisioningState - :param revision: NSX revision number. - :type revision: long - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'status': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'direction': {'key': 'properties.direction', 'type': 'str'}, - 'source': {'key': 'properties.source', 'type': 'str'}, - 'destination': {'key': 'properties.destination', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'revision': {'key': 'properties.revision', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkPortMirroring, self).__init__(**kwargs) - self.display_name = kwargs.get('display_name', None) - self.direction = kwargs.get('direction', None) - self.source = kwargs.get('source', None) - self.destination = kwargs.get('destination', None) - self.status = None - self.provisioning_state = None - self.revision = kwargs.get('revision', None) - - -class WorkloadNetworkPortMirroringList(msrest.serialization.Model): - """A list of NSX Port Mirroring. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The items on the page. - :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[WorkloadNetworkPortMirroring]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkPortMirroringList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class WorkloadNetworkPublicIP(ProxyResource): - """NSX Public IP Block. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param display_name: Display name of the Public IP Block. - :type display_name: str - :param number_of_public_i_ps: Number of Public IPs requested. - :type number_of_public_i_ps: long - :ivar public_ip_block: CIDR Block of the Public IP Block. - :vartype public_ip_block: str - :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", - "Failed", "Building", "Deleting", "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.avs.models.WorkloadNetworkPublicIPProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'public_ip_block': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'number_of_public_i_ps': {'key': 'properties.numberOfPublicIPs', 'type': 'long'}, - 'public_ip_block': {'key': 'properties.publicIPBlock', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkPublicIP, self).__init__(**kwargs) - self.display_name = kwargs.get('display_name', None) - self.number_of_public_i_ps = kwargs.get('number_of_public_i_ps', None) - self.public_ip_block = None - self.provisioning_state = None - - -class WorkloadNetworkPublicIPsList(msrest.serialization.Model): - """A list of NSX Public IP Blocks. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The items on the page. - :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[WorkloadNetworkPublicIP]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkPublicIPsList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class WorkloadNetworkSegment(ProxyResource): - """NSX Segment. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param display_name: Display name of the segment. - :type display_name: str - :param connected_gateway: Gateway which to connect segment to. - :type connected_gateway: str - :param subnet: Subnet which to connect segment to. - :type subnet: ~azure.mgmt.avs.models.WorkloadNetworkSegmentSubnet - :ivar port_vif: Port Vif which segment is associated with. - :vartype port_vif: list[~azure.mgmt.avs.models.WorkloadNetworkSegmentPortVif] - :ivar status: Segment status. Possible values include: "SUCCESS", "FAILURE". - :vartype status: str or ~azure.mgmt.avs.models.SegmentStatusEnum - :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", - "Failed", "Building", "Deleting", "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.avs.models.WorkloadNetworkSegmentProvisioningState - :param revision: NSX revision number. - :type revision: long - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'port_vif': {'readonly': True}, - 'status': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'connected_gateway': {'key': 'properties.connectedGateway', 'type': 'str'}, - 'subnet': {'key': 'properties.subnet', 'type': 'WorkloadNetworkSegmentSubnet'}, - 'port_vif': {'key': 'properties.portVif', 'type': '[WorkloadNetworkSegmentPortVif]'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'revision': {'key': 'properties.revision', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkSegment, self).__init__(**kwargs) - self.display_name = kwargs.get('display_name', None) - self.connected_gateway = kwargs.get('connected_gateway', None) - self.subnet = kwargs.get('subnet', None) - self.port_vif = None - self.status = None - self.provisioning_state = None - self.revision = kwargs.get('revision', None) - - -class WorkloadNetworkSegmentPortVif(msrest.serialization.Model): - """Ports and any VIF attached to segment. - - :param port_name: Name of port or VIF attached to segment. - :type port_name: str - """ - - _attribute_map = { - 'port_name': {'key': 'portName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkSegmentPortVif, self).__init__(**kwargs) - self.port_name = kwargs.get('port_name', None) - - -class WorkloadNetworkSegmentsList(msrest.serialization.Model): - """A list of NSX Segments. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The items on the page. - :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkSegment] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[WorkloadNetworkSegment]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkSegmentsList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class WorkloadNetworkSegmentSubnet(msrest.serialization.Model): - """Subnet configuration for segment. - - :param dhcp_ranges: DHCP Range assigned for subnet. - :type dhcp_ranges: list[str] - :param gateway_address: Gateway address. - :type gateway_address: str - """ - - _attribute_map = { - 'dhcp_ranges': {'key': 'dhcpRanges', 'type': '[str]'}, - 'gateway_address': {'key': 'gatewayAddress', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkSegmentSubnet, self).__init__(**kwargs) - self.dhcp_ranges = kwargs.get('dhcp_ranges', None) - self.gateway_address = kwargs.get('gateway_address', None) - - -class WorkloadNetworkVirtualMachine(ProxyResource): - """NSX Virtual Machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param display_name: Display name of the VM. - :type display_name: str - :ivar vm_type: Virtual machine type. Possible values include: "REGULAR", "EDGE", "SERVICE". - :vartype vm_type: str or ~azure.mgmt.avs.models.VMTypeEnum - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'vm_type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'vm_type': {'key': 'properties.vmType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkVirtualMachine, self).__init__(**kwargs) - self.display_name = kwargs.get('display_name', None) - self.vm_type = None - - -class WorkloadNetworkVirtualMachinesList(msrest.serialization.Model): - """A list of NSX Virtual Machines. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The items on the page. - :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[WorkloadNetworkVirtualMachine]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkVirtualMachinesList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class WorkloadNetworkVMGroup(ProxyResource): - """NSX VM Group. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param display_name: Display name of the VM group. - :type display_name: str - :param members: Virtual machine members of this group. - :type members: list[str] - :ivar status: VM Group status. Possible values include: "SUCCESS", "FAILURE". - :vartype status: str or ~azure.mgmt.avs.models.VMGroupStatusEnum - :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", - "Failed", "Building", "Deleting", "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.avs.models.WorkloadNetworkVMGroupProvisioningState - :param revision: NSX revision number. - :type revision: long - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'status': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'members': {'key': 'properties.members', 'type': '[str]'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'revision': {'key': 'properties.revision', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkVMGroup, self).__init__(**kwargs) - self.display_name = kwargs.get('display_name', None) - self.members = kwargs.get('members', None) - self.status = None - self.provisioning_state = None - self.revision = kwargs.get('revision', None) - - -class WorkloadNetworkVMGroupsList(msrest.serialization.Model): - """A list of NSX VM Groups. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The items on the page. - :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] - :ivar next_link: URL to get the next page if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[WorkloadNetworkVMGroup]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadNetworkVMGroupsList, self).__init__(**kwargs) - self.value = None - self.next_link = None diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_models_py3.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_models_py3.py index 792e14146f7f..c8959df11622 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_models_py3.py @@ -42,6 +42,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -59,8 +61,8 @@ class Addon(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param properties: The properties of an addon resource. - :type properties: ~azure.mgmt.avs.models.AddonProperties + :ivar properties: The properties of an addon resource. + :vartype properties: ~azure.mgmt.avs.models.AddonProperties """ _validation = { @@ -82,6 +84,10 @@ def __init__( properties: Optional["AddonProperties"] = None, **kwargs ): + """ + :keyword properties: The properties of an addon resource. + :paramtype properties: ~azure.mgmt.avs.models.AddonProperties + """ super(Addon, self).__init__(**kwargs) self.properties = properties @@ -96,9 +102,9 @@ class AddonProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param addon_type: Required. The type of private cloud addon.Constant filled by server. - Possible values include: "SRM", "VR", "HCX". - :type addon_type: str or ~azure.mgmt.avs.models.AddonType + :ivar addon_type: Required. The type of private cloud addon.Constant filled by server. Possible + values include: "SRM", "VR", "HCX". + :vartype addon_type: str or ~azure.mgmt.avs.models.AddonType :ivar provisioning_state: The state of the addon provisioning. Possible values include: "Succeeded", "Failed", "Cancelled", "Building", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState @@ -122,6 +128,8 @@ def __init__( self, **kwargs ): + """ + """ super(AddonProperties, self).__init__(**kwargs) self.addon_type = None # type: Optional[str] self.provisioning_state = None @@ -134,14 +142,14 @@ class AddonHcxProperties(AddonProperties): All required parameters must be populated in order to send to Azure. - :param addon_type: Required. The type of private cloud addon.Constant filled by server. - Possible values include: "SRM", "VR", "HCX". - :type addon_type: str or ~azure.mgmt.avs.models.AddonType + :ivar addon_type: Required. The type of private cloud addon.Constant filled by server. Possible + values include: "SRM", "VR", "HCX". + :vartype addon_type: str or ~azure.mgmt.avs.models.AddonType :ivar provisioning_state: The state of the addon provisioning. Possible values include: "Succeeded", "Failed", "Cancelled", "Building", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState - :param offer: Required. The HCX offer, example VMware MaaS Cloud Provider (Enterprise). - :type offer: str + :ivar offer: Required. The HCX offer, example VMware MaaS Cloud Provider (Enterprise). + :vartype offer: str """ _validation = { @@ -162,6 +170,10 @@ def __init__( offer: str, **kwargs ): + """ + :keyword offer: Required. The HCX offer, example VMware MaaS Cloud Provider (Enterprise). + :paramtype offer: str + """ super(AddonHcxProperties, self).__init__(**kwargs) self.addon_type = 'HCX' # type: str self.offer = offer @@ -192,6 +204,8 @@ def __init__( self, **kwargs ): + """ + """ super(AddonList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -204,14 +218,14 @@ class AddonSrmProperties(AddonProperties): All required parameters must be populated in order to send to Azure. - :param addon_type: Required. The type of private cloud addon.Constant filled by server. - Possible values include: "SRM", "VR", "HCX". - :type addon_type: str or ~azure.mgmt.avs.models.AddonType + :ivar addon_type: Required. The type of private cloud addon.Constant filled by server. Possible + values include: "SRM", "VR", "HCX". + :vartype addon_type: str or ~azure.mgmt.avs.models.AddonType :ivar provisioning_state: The state of the addon provisioning. Possible values include: "Succeeded", "Failed", "Cancelled", "Building", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState - :param license_key: The Site Recovery Manager (SRM) license. - :type license_key: str + :ivar license_key: The Site Recovery Manager (SRM) license. + :vartype license_key: str """ _validation = { @@ -231,6 +245,10 @@ def __init__( license_key: Optional[str] = None, **kwargs ): + """ + :keyword license_key: The Site Recovery Manager (SRM) license. + :paramtype license_key: str + """ super(AddonSrmProperties, self).__init__(**kwargs) self.addon_type = 'SRM' # type: str self.license_key = license_key @@ -243,14 +261,14 @@ class AddonVrProperties(AddonProperties): All required parameters must be populated in order to send to Azure. - :param addon_type: Required. The type of private cloud addon.Constant filled by server. - Possible values include: "SRM", "VR", "HCX". - :type addon_type: str or ~azure.mgmt.avs.models.AddonType + :ivar addon_type: Required. The type of private cloud addon.Constant filled by server. Possible + values include: "SRM", "VR", "HCX". + :vartype addon_type: str or ~azure.mgmt.avs.models.AddonType :ivar provisioning_state: The state of the addon provisioning. Possible values include: "Succeeded", "Failed", "Cancelled", "Building", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState - :param vrs_count: Required. The vSphere Replication Server (VRS) count. - :type vrs_count: int + :ivar vrs_count: Required. The vSphere Replication Server (VRS) count. + :vartype vrs_count: int """ _validation = { @@ -271,6 +289,10 @@ def __init__( vrs_count: int, **kwargs ): + """ + :keyword vrs_count: Required. The vSphere Replication Server (VRS) count. + :paramtype vrs_count: int + """ super(AddonVrProperties, self).__init__(**kwargs) self.addon_type = 'VR' # type: str self.vrs_count = vrs_count @@ -309,6 +331,8 @@ def __init__( self, **kwargs ): + """ + """ super(AdminCredentials, self).__init__(**kwargs) self.nsxt_username = None self.nsxt_password = None @@ -319,13 +343,13 @@ def __init__( class AvailabilityProperties(msrest.serialization.Model): """The properties describing private cloud availability zone distribution. - :param strategy: The availability strategy for the private cloud. Possible values include: + :ivar strategy: The availability strategy for the private cloud. Possible values include: "SingleZone", "DualZone". - :type strategy: str or ~azure.mgmt.avs.models.AvailabilityStrategy - :param zone: The primary availability zone for the private cloud. - :type zone: int - :param secondary_zone: The secondary availability zone for the private cloud. - :type secondary_zone: int + :vartype strategy: str or ~azure.mgmt.avs.models.AvailabilityStrategy + :ivar zone: The primary availability zone for the private cloud. + :vartype zone: int + :ivar secondary_zone: The secondary availability zone for the private cloud. + :vartype secondary_zone: int """ _attribute_map = { @@ -342,6 +366,15 @@ def __init__( secondary_zone: Optional[int] = None, **kwargs ): + """ + :keyword strategy: The availability strategy for the private cloud. Possible values include: + "SingleZone", "DualZone". + :paramtype strategy: str or ~azure.mgmt.avs.models.AvailabilityStrategy + :keyword zone: The primary availability zone for the private cloud. + :paramtype zone: int + :keyword secondary_zone: The secondary availability zone for the private cloud. + :paramtype secondary_zone: int + """ super(AvailabilityProperties, self).__init__(**kwargs) self.strategy = strategy self.zone = zone @@ -381,6 +414,8 @@ def __init__( self, **kwargs ): + """ + """ super(Circuit, self).__init__(**kwargs) self.primary_subnet = None self.secondary_subnet = None @@ -402,8 +437,8 @@ class CloudLink(Resource): :ivar status: The state of the cloud link. Possible values include: "Active", "Building", "Deleting", "Failed", "Disconnected". :vartype status: str or ~azure.mgmt.avs.models.CloudLinkStatus - :param linked_cloud: Identifier of the other private cloud participating in the link. - :type linked_cloud: str + :ivar linked_cloud: Identifier of the other private cloud participating in the link. + :vartype linked_cloud: str """ _validation = { @@ -427,6 +462,10 @@ def __init__( linked_cloud: Optional[str] = None, **kwargs ): + """ + :keyword linked_cloud: Identifier of the other private cloud participating in the link. + :paramtype linked_cloud: str + """ super(CloudLink, self).__init__(**kwargs) self.status = None self.linked_cloud = linked_cloud @@ -457,6 +496,8 @@ def __init__( self, **kwargs ): + """ + """ super(CloudLinkList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -475,17 +516,17 @@ class Cluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param sku: Required. The cluster SKU. - :type sku: ~azure.mgmt.avs.models.Sku - :param cluster_size: The cluster size. - :type cluster_size: int + :ivar sku: Required. The cluster SKU. + :vartype sku: ~azure.mgmt.avs.models.Sku + :ivar cluster_size: The cluster size. + :vartype cluster_size: int :ivar provisioning_state: The state of the cluster provisioning. Possible values include: "Succeeded", "Failed", "Cancelled", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState :ivar cluster_id: The identity. :vartype cluster_id: int - :param hosts: The hosts. - :type hosts: list[str] + :ivar hosts: The hosts. + :vartype hosts: list[str] """ _validation = { @@ -516,6 +557,14 @@ def __init__( hosts: Optional[List[str]] = None, **kwargs ): + """ + :keyword sku: Required. The cluster SKU. + :paramtype sku: ~azure.mgmt.avs.models.Sku + :keyword cluster_size: The cluster size. + :paramtype cluster_size: int + :keyword hosts: The hosts. + :paramtype hosts: list[str] + """ super(Cluster, self).__init__(**kwargs) self.sku = sku self.cluster_size = cluster_size @@ -549,6 +598,8 @@ def __init__( self, **kwargs ): + """ + """ super(ClusterList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -559,15 +610,15 @@ class CommonClusterProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param cluster_size: The cluster size. - :type cluster_size: int + :ivar cluster_size: The cluster size. + :vartype cluster_size: int :ivar provisioning_state: The state of the cluster provisioning. Possible values include: "Succeeded", "Failed", "Cancelled", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState :ivar cluster_id: The identity. :vartype cluster_id: int - :param hosts: The hosts. - :type hosts: list[str] + :ivar hosts: The hosts. + :vartype hosts: list[str] """ _validation = { @@ -589,6 +640,12 @@ def __init__( hosts: Optional[List[str]] = None, **kwargs ): + """ + :keyword cluster_size: The cluster size. + :paramtype cluster_size: int + :keyword hosts: The hosts. + :paramtype hosts: list[str] + """ super(CommonClusterProperties, self).__init__(**kwargs) self.cluster_size = cluster_size self.provisioning_state = None @@ -601,15 +658,15 @@ class ClusterProperties(CommonClusterProperties): Variables are only populated by the server, and will be ignored when sending a request. - :param cluster_size: The cluster size. - :type cluster_size: int + :ivar cluster_size: The cluster size. + :vartype cluster_size: int :ivar provisioning_state: The state of the cluster provisioning. Possible values include: "Succeeded", "Failed", "Cancelled", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState :ivar cluster_id: The identity. :vartype cluster_id: int - :param hosts: The hosts. - :type hosts: list[str] + :ivar hosts: The hosts. + :vartype hosts: list[str] """ _validation = { @@ -631,16 +688,22 @@ def __init__( hosts: Optional[List[str]] = None, **kwargs ): + """ + :keyword cluster_size: The cluster size. + :paramtype cluster_size: int + :keyword hosts: The hosts. + :paramtype hosts: list[str] + """ super(ClusterProperties, self).__init__(cluster_size=cluster_size, hosts=hosts, **kwargs) class ClusterUpdate(msrest.serialization.Model): """An update of a cluster resource. - :param cluster_size: The cluster size. - :type cluster_size: int - :param hosts: The hosts. - :type hosts: list[str] + :ivar cluster_size: The cluster size. + :vartype cluster_size: int + :ivar hosts: The hosts. + :vartype hosts: list[str] """ _attribute_map = { @@ -655,6 +718,12 @@ def __init__( hosts: Optional[List[str]] = None, **kwargs ): + """ + :keyword cluster_size: The cluster size. + :paramtype cluster_size: int + :keyword hosts: The hosts. + :paramtype hosts: list[str] + """ super(ClusterUpdate, self).__init__(**kwargs) self.cluster_size = cluster_size self.hosts = hosts @@ -674,10 +743,10 @@ class Datastore(Resource): :ivar provisioning_state: The state of the datastore provisioning. Possible values include: "Succeeded", "Failed", "Cancelled", "Pending", "Creating", "Updating", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.avs.models.DatastoreProvisioningState - :param net_app_volume: An Azure NetApp Files volume. - :type net_app_volume: ~azure.mgmt.avs.models.NetAppVolume - :param disk_pool_volume: An iSCSI volume. - :type disk_pool_volume: ~azure.mgmt.avs.models.DiskPoolVolume + :ivar net_app_volume: An Azure NetApp Files volume. + :vartype net_app_volume: ~azure.mgmt.avs.models.NetAppVolume + :ivar disk_pool_volume: An iSCSI volume. + :vartype disk_pool_volume: ~azure.mgmt.avs.models.DiskPoolVolume :ivar status: The operational status of the datastore. Possible values include: "Unknown", "Accessible", "Inaccessible", "Attached", "Detached", "LostCommunication", "DeadOrError". :vartype status: str or ~azure.mgmt.avs.models.DatastoreStatus @@ -708,6 +777,12 @@ def __init__( disk_pool_volume: Optional["DiskPoolVolume"] = None, **kwargs ): + """ + :keyword net_app_volume: An Azure NetApp Files volume. + :paramtype net_app_volume: ~azure.mgmt.avs.models.NetAppVolume + :keyword disk_pool_volume: An iSCSI volume. + :paramtype disk_pool_volume: ~azure.mgmt.avs.models.DiskPoolVolume + """ super(Datastore, self).__init__(**kwargs) self.provisioning_state = None self.net_app_volume = net_app_volume @@ -740,6 +815,8 @@ def __init__( self, **kwargs ): + """ + """ super(DatastoreList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -752,13 +829,13 @@ class DiskPoolVolume(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param target_id: Required. Azure resource ID of the iSCSI target. - :type target_id: str - :param lun_name: Required. Name of the LUN to be used for datastore. - :type lun_name: str - :param mount_option: Mode that describes whether the LUN has to be mounted as a datastore or + :ivar target_id: Required. Azure resource ID of the iSCSI target. + :vartype target_id: str + :ivar lun_name: Required. Name of the LUN to be used for datastore. + :vartype lun_name: str + :ivar mount_option: Mode that describes whether the LUN has to be mounted as a datastore or attached as a LUN. Possible values include: "MOUNT", "ATTACH". Default value: "MOUNT". - :type mount_option: str or ~azure.mgmt.avs.models.MountOptionEnum + :vartype mount_option: str or ~azure.mgmt.avs.models.MountOptionEnum :ivar path: Device path. :vartype path: str """ @@ -784,6 +861,15 @@ def __init__( mount_option: Optional[Union[str, "MountOptionEnum"]] = "MOUNT", **kwargs ): + """ + :keyword target_id: Required. Azure resource ID of the iSCSI target. + :paramtype target_id: str + :keyword lun_name: Required. Name of the LUN to be used for datastore. + :paramtype lun_name: str + :keyword mount_option: Mode that describes whether the LUN has to be mounted as a datastore or + attached as a LUN. Possible values include: "MOUNT", "ATTACH". Default value: "MOUNT". + :paramtype mount_option: str or ~azure.mgmt.avs.models.MountOptionEnum + """ super(DiskPoolVolume, self).__init__(**kwargs) self.target_id = target_id self.lun_name = lun_name @@ -794,11 +880,11 @@ def __init__( class Encryption(msrest.serialization.Model): """The properties of customer managed encryption key. - :param status: Status of customer managed encryption key. Possible values include: "Enabled", + :ivar status: Status of customer managed encryption key. Possible values include: "Enabled", "Disabled". - :type status: str or ~azure.mgmt.avs.models.EncryptionState - :param key_vault_properties: The key vault where the encryption key is stored. - :type key_vault_properties: ~azure.mgmt.avs.models.EncryptionKeyVaultProperties + :vartype status: str or ~azure.mgmt.avs.models.EncryptionState + :ivar key_vault_properties: The key vault where the encryption key is stored. + :vartype key_vault_properties: ~azure.mgmt.avs.models.EncryptionKeyVaultProperties """ _attribute_map = { @@ -813,6 +899,13 @@ def __init__( key_vault_properties: Optional["EncryptionKeyVaultProperties"] = None, **kwargs ): + """ + :keyword status: Status of customer managed encryption key. Possible values include: "Enabled", + "Disabled". + :paramtype status: str or ~azure.mgmt.avs.models.EncryptionState + :keyword key_vault_properties: The key vault where the encryption key is stored. + :paramtype key_vault_properties: ~azure.mgmt.avs.models.EncryptionKeyVaultProperties + """ super(Encryption, self).__init__(**kwargs) self.status = status self.key_vault_properties = key_vault_properties @@ -823,12 +916,12 @@ class EncryptionKeyVaultProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param key_name: The name of the key. - :type key_name: str - :param key_version: The version of the key. - :type key_version: str - :param key_vault_url: The URL of the vault. - :type key_vault_url: str + :ivar key_name: The name of the key. + :vartype key_name: str + :ivar key_version: The version of the key. + :vartype key_version: str + :ivar key_vault_url: The URL of the vault. + :vartype key_vault_url: str :ivar key_state: The state of key provided. Possible values include: "Connected", "AccessDenied". :vartype key_state: str or ~azure.mgmt.avs.models.EncryptionKeyStatus @@ -858,6 +951,14 @@ def __init__( key_vault_url: Optional[str] = None, **kwargs ): + """ + :keyword key_name: The name of the key. + :paramtype key_name: str + :keyword key_version: The version of the key. + :paramtype key_version: str + :keyword key_vault_url: The URL of the vault. + :paramtype key_vault_url: str + """ super(EncryptionKeyVaultProperties, self).__init__(**kwargs) self.key_name = key_name self.key_version = key_version @@ -895,6 +996,8 @@ def __init__( self, **kwargs ): + """ + """ super(Endpoints, self).__init__(**kwargs) self.nsxt_manager = None self.vcsa = None @@ -926,6 +1029,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -968,6 +1073,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorResponse, self).__init__(**kwargs) self.code = None self.message = None @@ -995,8 +1102,8 @@ class ExpressRouteAuthorization(Resource): :vartype express_route_authorization_id: str :ivar express_route_authorization_key: The key of the ExpressRoute Circuit Authorization. :vartype express_route_authorization_key: str - :param express_route_id: The ID of the ExpressRoute Circuit. - :type express_route_id: str + :ivar express_route_id: The ID of the ExpressRoute Circuit. + :vartype express_route_id: str """ _validation = { @@ -1024,6 +1131,10 @@ def __init__( express_route_id: Optional[str] = None, **kwargs ): + """ + :keyword express_route_id: The ID of the ExpressRoute Circuit. + :paramtype express_route_id: str + """ super(ExpressRouteAuthorization, self).__init__(**kwargs) self.provisioning_state = None self.express_route_authorization_id = None @@ -1056,6 +1167,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExpressRouteAuthorizationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1079,18 +1192,18 @@ class GlobalReachConnection(Resource): :ivar address_prefix: The network used for global reach carved out from the original network block provided for the private cloud. :vartype address_prefix: str - :param authorization_key: Authorization key from the peer express route used for the global + :ivar authorization_key: Authorization key from the peer express route used for the global reach connection. - :type authorization_key: str + :vartype authorization_key: str :ivar circuit_connection_status: The connection status of the global reach connection. Possible values include: "Connected", "Connecting", "Disconnected". :vartype circuit_connection_status: str or ~azure.mgmt.avs.models.GlobalReachConnectionStatus - :param peer_express_route_circuit: Identifier of the ExpressRoute Circuit to peer with in the + :ivar peer_express_route_circuit: Identifier of the ExpressRoute Circuit to peer with in the global reach connection. - :type peer_express_route_circuit: str - :param express_route_id: The ID of the Private Cloud's ExpressRoute Circuit that is + :vartype peer_express_route_circuit: str + :ivar express_route_id: The ID of the Private Cloud's ExpressRoute Circuit that is participating in the global reach connection. - :type express_route_id: str + :vartype express_route_id: str """ _validation = { @@ -1122,6 +1235,17 @@ def __init__( express_route_id: Optional[str] = None, **kwargs ): + """ + :keyword authorization_key: Authorization key from the peer express route used for the global + reach connection. + :paramtype authorization_key: str + :keyword peer_express_route_circuit: Identifier of the ExpressRoute Circuit to peer with in the + global reach connection. + :paramtype peer_express_route_circuit: str + :keyword express_route_id: The ID of the Private Cloud's ExpressRoute Circuit that is + participating in the global reach connection. + :paramtype express_route_id: str + """ super(GlobalReachConnection, self).__init__(**kwargs) self.provisioning_state = None self.address_prefix = None @@ -1156,6 +1280,8 @@ def __init__( self, **kwargs ): + """ + """ super(GlobalReachConnectionList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1199,6 +1325,8 @@ def __init__( self, **kwargs ): + """ + """ super(HcxEnterpriseSite, self).__init__(**kwargs) self.activation_key = None self.status = None @@ -1229,6 +1357,8 @@ def __init__( self, **kwargs ): + """ + """ super(HcxEnterpriseSiteList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1237,29 +1367,29 @@ def __init__( class IdentitySource(msrest.serialization.Model): """vCenter Single Sign On Identity Source. - :param name: The name of the identity source. - :type name: str - :param alias: The domain's NetBIOS name. - :type alias: str - :param domain: The domain's dns name. - :type domain: str - :param base_user_dn: The base distinguished name for users. - :type base_user_dn: str - :param base_group_dn: The base distinguished name for groups. - :type base_group_dn: str - :param primary_server: Primary server URL. - :type primary_server: str - :param secondary_server: Secondary server URL. - :type secondary_server: str - :param ssl: Protect LDAP communication using SSL certificate (LDAPS). Possible values include: + :ivar name: The name of the identity source. + :vartype name: str + :ivar alias: The domain's NetBIOS name. + :vartype alias: str + :ivar domain: The domain's dns name. + :vartype domain: str + :ivar base_user_dn: The base distinguished name for users. + :vartype base_user_dn: str + :ivar base_group_dn: The base distinguished name for groups. + :vartype base_group_dn: str + :ivar primary_server: Primary server URL. + :vartype primary_server: str + :ivar secondary_server: Secondary server URL. + :vartype secondary_server: str + :ivar ssl: Protect LDAP communication using SSL certificate (LDAPS). Possible values include: "Enabled", "Disabled". - :type ssl: str or ~azure.mgmt.avs.models.SslEnum - :param username: The ID of an Active Directory user with a minimum of read-only access to Base + :vartype ssl: str or ~azure.mgmt.avs.models.SslEnum + :ivar username: The ID of an Active Directory user with a minimum of read-only access to Base DN for users and group. - :type username: str - :param password: The password of the Active Directory user with a minimum of read-only access - to Base DN for users and groups. - :type password: str + :vartype username: str + :ivar password: The password of the Active Directory user with a minimum of read-only access to + Base DN for users and groups. + :vartype password: str """ _attribute_map = { @@ -1290,6 +1420,31 @@ def __init__( password: Optional[str] = None, **kwargs ): + """ + :keyword name: The name of the identity source. + :paramtype name: str + :keyword alias: The domain's NetBIOS name. + :paramtype alias: str + :keyword domain: The domain's dns name. + :paramtype domain: str + :keyword base_user_dn: The base distinguished name for users. + :paramtype base_user_dn: str + :keyword base_group_dn: The base distinguished name for groups. + :paramtype base_group_dn: str + :keyword primary_server: Primary server URL. + :paramtype primary_server: str + :keyword secondary_server: Secondary server URL. + :paramtype secondary_server: str + :keyword ssl: Protect LDAP communication using SSL certificate (LDAPS). Possible values + include: "Enabled", "Disabled". + :paramtype ssl: str or ~azure.mgmt.avs.models.SslEnum + :keyword username: The ID of an Active Directory user with a minimum of read-only access to + Base DN for users and group. + :paramtype username: str + :keyword password: The password of the Active Directory user with a minimum of read-only access + to Base DN for users and groups. + :paramtype password: str + """ super(IdentitySource, self).__init__(**kwargs) self.name = name self.alias = alias @@ -1306,12 +1461,12 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log. - :type name: str - :param display_name: Localized friendly display name of the log. - :type display_name: str - :param blob_duration: Blob duration of the log. - :type blob_duration: str + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str """ _attribute_map = { @@ -1328,6 +1483,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + :keyword blob_duration: Blob duration of the log. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1339,15 +1502,15 @@ class ManagementCluster(CommonClusterProperties): Variables are only populated by the server, and will be ignored when sending a request. - :param cluster_size: The cluster size. - :type cluster_size: int + :ivar cluster_size: The cluster size. + :vartype cluster_size: int :ivar provisioning_state: The state of the cluster provisioning. Possible values include: "Succeeded", "Failed", "Cancelled", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState :ivar cluster_id: The identity. :vartype cluster_id: int - :param hosts: The hosts. - :type hosts: list[str] + :ivar hosts: The hosts. + :vartype hosts: list[str] """ _validation = { @@ -1369,21 +1532,27 @@ def __init__( hosts: Optional[List[str]] = None, **kwargs ): + """ + :keyword cluster_size: The cluster size. + :paramtype cluster_size: int + :keyword hosts: The hosts. + :paramtype hosts: list[str] + """ super(ManagementCluster, self).__init__(cluster_size=cluster_size, hosts=hosts, **kwargs) class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension. - :type name: str - :param display_name: Localized friendly display name of the dimension. - :type display_name: str - :param internal_name: Name of the dimension as it appears in MDM. - :type internal_name: str - :param to_be_exported_for_shoebox: A boolean flag indicating whether this dimension should be + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar internal_name: Name of the dimension as it appears in MDM. + :vartype internal_name: str + :ivar to_be_exported_for_shoebox: A boolean flag indicating whether this dimension should be included for the shoebox export scenario. - :type to_be_exported_for_shoebox: bool + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1402,6 +1571,17 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword internal_name: Name of the dimension as it appears in MDM. + :paramtype internal_name: str + :keyword to_be_exported_for_shoebox: A boolean flag indicating whether this dimension should be + included for the shoebox export scenario. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1412,35 +1592,35 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric. - :type name: str - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :param unit: Unit that makes sense for the metric. - :type unit: str - :param category: Name of the metric category that the metric belongs to. A metric can only + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: Unit that makes sense for the metric. + :vartype unit: str + :ivar category: Name of the metric category that the metric belongs to. A metric can only belong to a single category. - :type category: str - :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + :vartype category: str + :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. - :type aggregation_type: str - :param supported_aggregation_types: Supported aggregation types. - :type supported_aggregation_types: list[str] - :param supported_time_grain_types: Supported time grain types. - :type supported_time_grain_types: list[str] - :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: Supported time grain types. + :vartype supported_time_grain_types: list[str] + :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. - :type fill_gap_with_zero: bool - :param dimensions: Dimensions of the metric. - :type dimensions: list[~azure.mgmt.avs.models.MetricDimension] - :param enable_regional_mdm_account: Whether or not the service is using regional MDM accounts. - :type enable_regional_mdm_account: str - :param source_mdm_account: The name of the MDM account. - :type source_mdm_account: str - :param source_mdm_namespace: The name of the MDM namespace. - :type source_mdm_namespace: str + :vartype fill_gap_with_zero: bool + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~azure.mgmt.avs.models.MetricDimension] + :ivar enable_regional_mdm_account: Whether or not the service is using regional MDM accounts. + :vartype enable_regional_mdm_account: str + :ivar source_mdm_account: The name of the MDM account. + :vartype source_mdm_account: str + :ivar source_mdm_namespace: The name of the MDM namespace. + :vartype source_mdm_namespace: str """ _attribute_map = { @@ -1477,6 +1657,38 @@ def __init__( source_mdm_namespace: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Localized friendly display name of the metric. + :paramtype display_name: str + :keyword display_description: Localized friendly description of the metric. + :paramtype display_description: str + :keyword unit: Unit that makes sense for the metric. + :paramtype unit: str + :keyword category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :paramtype category: str + :keyword aggregation_type: Only provide one value for this field. Valid values: Average, + Minimum, Maximum, Total, Count. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Supported aggregation types. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: Supported time grain types. + :paramtype supported_time_grain_types: list[str] + :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :paramtype fill_gap_with_zero: bool + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~azure.mgmt.avs.models.MetricDimension] + :keyword enable_regional_mdm_account: Whether or not the service is using regional MDM + accounts. + :paramtype enable_regional_mdm_account: str + :keyword source_mdm_account: The name of the MDM account. + :paramtype source_mdm_account: str + :keyword source_mdm_namespace: The name of the MDM namespace. + :paramtype source_mdm_namespace: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1498,8 +1710,8 @@ class NetAppVolume(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. Azure resource ID of the NetApp volume. - :type id: str + :ivar id: Required. Azure resource ID of the NetApp volume. + :vartype id: str """ _validation = { @@ -1516,6 +1728,10 @@ def __init__( id: str, **kwargs ): + """ + :keyword id: Required. Azure resource ID of the NetApp volume. + :paramtype id: str + """ super(NetAppVolume, self).__init__(**kwargs) self.id = id @@ -1529,13 +1745,13 @@ class Operation(msrest.serialization.Model): :vartype name: str :ivar display: Contains the localized display information for this operation. :vartype display: ~azure.mgmt.avs.models.OperationDisplay - :param is_data_action: Gets or sets a value indicating whether the operation is a data action - or not. - :type is_data_action: bool - :param origin: Origin of the operation. - :type origin: str - :param properties: Properties of the operation. - :type properties: ~azure.mgmt.avs.models.OperationProperties + :ivar is_data_action: Gets or sets a value indicating whether the operation is a data action or + not. + :vartype is_data_action: bool + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.avs.models.OperationProperties """ _validation = { @@ -1559,6 +1775,15 @@ def __init__( properties: Optional["OperationProperties"] = None, **kwargs ): + """ + :keyword is_data_action: Gets or sets a value indicating whether the operation is a data action + or not. + :paramtype is_data_action: bool + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.avs.models.OperationProperties + """ super(Operation, self).__init__(**kwargs) self.name = None self.display = None @@ -1600,6 +1825,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = None self.resource = None @@ -1632,6 +1859,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1640,8 +1869,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: Service specifications of the operation. - :type service_specification: ~azure.mgmt.avs.models.ServiceSpecification + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: ~azure.mgmt.avs.models.ServiceSpecification """ _attribute_map = { @@ -1654,6 +1883,10 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword service_specification: Service specifications of the operation. + :paramtype service_specification: ~azure.mgmt.avs.models.ServiceSpecification + """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -1683,6 +1916,8 @@ def __init__( self, **kwargs ): + """ + """ super(PlacementPoliciesList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1699,8 +1934,8 @@ class PlacementPolicy(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param properties: placement policy properties. - :type properties: ~azure.mgmt.avs.models.PlacementPolicyProperties + :ivar properties: placement policy properties. + :vartype properties: ~azure.mgmt.avs.models.PlacementPolicyProperties """ _validation = { @@ -1722,6 +1957,10 @@ def __init__( properties: Optional["PlacementPolicyProperties"] = None, **kwargs ): + """ + :keyword properties: placement policy properties. + :paramtype properties: ~azure.mgmt.avs.models.PlacementPolicyProperties + """ super(PlacementPolicy, self).__init__(**kwargs) self.properties = properties @@ -1736,14 +1975,14 @@ class PlacementPolicyProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. placement policy type.Constant filled by server. Possible values - include: "VmVm", "VmHost". - :type type: str or ~azure.mgmt.avs.models.PlacementPolicyType - :param state: Whether the placement policy is enabled or disabled. Possible values include: + :ivar type: Required. placement policy type.Constant filled by server. Possible values include: + "VmVm", "VmHost". + :vartype type: str or ~azure.mgmt.avs.models.PlacementPolicyType + :ivar state: Whether the placement policy is enabled or disabled. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.avs.models.PlacementPolicyState - :param display_name: Display name of the placement policy. - :type display_name: str + :vartype state: str or ~azure.mgmt.avs.models.PlacementPolicyState + :ivar display_name: Display name of the placement policy. + :vartype display_name: str :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", "Failed", "Building", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.PlacementPolicyProvisioningState @@ -1772,6 +2011,13 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword state: Whether the placement policy is enabled or disabled. Possible values include: + "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.avs.models.PlacementPolicyState + :keyword display_name: Display name of the placement policy. + :paramtype display_name: str + """ super(PlacementPolicyProperties, self).__init__(**kwargs) self.type = None # type: Optional[str] self.state = state @@ -1782,13 +2028,13 @@ def __init__( class PlacementPolicyUpdate(msrest.serialization.Model): """An update of a DRS placement policy resource. - :param state: Whether the placement policy is enabled or disabled. Possible values include: + :ivar state: Whether the placement policy is enabled or disabled. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.avs.models.PlacementPolicyState - :param vm_members: Virtual machine members list. - :type vm_members: list[str] - :param host_members: Host members list. - :type host_members: list[str] + :vartype state: str or ~azure.mgmt.avs.models.PlacementPolicyState + :ivar vm_members: Virtual machine members list. + :vartype vm_members: list[str] + :ivar host_members: Host members list. + :vartype host_members: list[str] """ _attribute_map = { @@ -1805,6 +2051,15 @@ def __init__( host_members: Optional[List[str]] = None, **kwargs ): + """ + :keyword state: Whether the placement policy is enabled or disabled. Possible values include: + "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.avs.models.PlacementPolicyState + :keyword vm_members: Virtual machine members list. + :paramtype vm_members: list[str] + :keyword host_members: Host members list. + :paramtype host_members: list[str] + """ super(PlacementPolicyUpdate, self).__init__(**kwargs) self.state = state self.vm_members = vm_members @@ -1822,10 +2077,10 @@ class TrackedResource(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -1849,6 +2104,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -1867,37 +2128,37 @@ class PrivateCloud(TrackedResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: Required. The private cloud SKU. - :type sku: ~azure.mgmt.avs.models.Sku - :param identity: The identity of the private cloud, if configured. - :type identity: ~azure.mgmt.avs.models.PrivateCloudIdentity - :param management_cluster: The default cluster used for management. - :type management_cluster: ~azure.mgmt.avs.models.ManagementCluster - :param internet: Connectivity to internet is enabled or disabled. Possible values include: + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Required. The private cloud SKU. + :vartype sku: ~azure.mgmt.avs.models.Sku + :ivar identity: The identity of the private cloud, if configured. + :vartype identity: ~azure.mgmt.avs.models.PrivateCloudIdentity + :ivar management_cluster: The default cluster used for management. + :vartype management_cluster: ~azure.mgmt.avs.models.ManagementCluster + :ivar internet: Connectivity to internet is enabled or disabled. Possible values include: "Enabled", "Disabled". Default value: "Disabled". - :type internet: str or ~azure.mgmt.avs.models.InternetEnum - :param identity_sources: vCenter Single Sign On Identity Sources. - :type identity_sources: list[~azure.mgmt.avs.models.IdentitySource] - :param availability: Properties describing how the cloud is distributed across availability + :vartype internet: str or ~azure.mgmt.avs.models.InternetEnum + :ivar identity_sources: vCenter Single Sign On Identity Sources. + :vartype identity_sources: list[~azure.mgmt.avs.models.IdentitySource] + :ivar availability: Properties describing how the cloud is distributed across availability zones. - :type availability: ~azure.mgmt.avs.models.AvailabilityProperties - :param encryption: Customer managed key encryption, can be enabled or disabled. - :type encryption: ~azure.mgmt.avs.models.Encryption + :vartype availability: ~azure.mgmt.avs.models.AvailabilityProperties + :ivar encryption: Customer managed key encryption, can be enabled or disabled. + :vartype encryption: ~azure.mgmt.avs.models.Encryption :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", "Failed", "Cancelled", "Pending", "Building", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.PrivateCloudProvisioningState - :param circuit: An ExpressRoute Circuit. - :type circuit: ~azure.mgmt.avs.models.Circuit + :ivar circuit: An ExpressRoute Circuit. + :vartype circuit: ~azure.mgmt.avs.models.Circuit :ivar endpoints: The endpoints. :vartype endpoints: ~azure.mgmt.avs.models.Endpoints - :param network_block: The block of addresses should be unique across VNet in your subscription + :ivar network_block: The block of addresses should be unique across VNet in your subscription as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where A,B,C,D are between 0 and 255, and X is between 0 and 22. - :type network_block: str + :vartype network_block: str :ivar management_network: Network used to access vCenter Server and NSX-T Manager. :vartype management_network: str :ivar provisioning_network: Used for virtual machine cold migration, cloning, and snapshot @@ -1905,21 +2166,21 @@ class PrivateCloud(TrackedResource): :vartype provisioning_network: str :ivar vmotion_network: Used for live migration of virtual machines. :vartype vmotion_network: str - :param vcenter_password: Optionally, set the vCenter admin password when the private cloud is + :ivar vcenter_password: Optionally, set the vCenter admin password when the private cloud is created. - :type vcenter_password: str - :param nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is + :vartype vcenter_password: str + :ivar nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is created. - :type nsxt_password: str + :vartype nsxt_password: str :ivar vcenter_certificate_thumbprint: Thumbprint of the vCenter Server SSL certificate. :vartype vcenter_certificate_thumbprint: str :ivar nsxt_certificate_thumbprint: Thumbprint of the NSX-T Manager SSL certificate. :vartype nsxt_certificate_thumbprint: str :ivar external_cloud_links: Array of cloud link IDs from other clouds that connect to this one. :vartype external_cloud_links: list[str] - :param secondary_circuit: A secondary expressRoute circuit from a separate AZ. Only present in - a stretched private cloud. - :type secondary_circuit: ~azure.mgmt.avs.models.Circuit + :ivar secondary_circuit: A secondary expressRoute circuit from a separate AZ. Only present in a + stretched private cloud. + :vartype secondary_circuit: ~azure.mgmt.avs.models.Circuit """ _validation = { @@ -1984,6 +2245,43 @@ def __init__( secondary_circuit: Optional["Circuit"] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Required. The private cloud SKU. + :paramtype sku: ~azure.mgmt.avs.models.Sku + :keyword identity: The identity of the private cloud, if configured. + :paramtype identity: ~azure.mgmt.avs.models.PrivateCloudIdentity + :keyword management_cluster: The default cluster used for management. + :paramtype management_cluster: ~azure.mgmt.avs.models.ManagementCluster + :keyword internet: Connectivity to internet is enabled or disabled. Possible values include: + "Enabled", "Disabled". Default value: "Disabled". + :paramtype internet: str or ~azure.mgmt.avs.models.InternetEnum + :keyword identity_sources: vCenter Single Sign On Identity Sources. + :paramtype identity_sources: list[~azure.mgmt.avs.models.IdentitySource] + :keyword availability: Properties describing how the cloud is distributed across availability + zones. + :paramtype availability: ~azure.mgmt.avs.models.AvailabilityProperties + :keyword encryption: Customer managed key encryption, can be enabled or disabled. + :paramtype encryption: ~azure.mgmt.avs.models.Encryption + :keyword circuit: An ExpressRoute Circuit. + :paramtype circuit: ~azure.mgmt.avs.models.Circuit + :keyword network_block: The block of addresses should be unique across VNet in your + subscription as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where + A,B,C,D are between 0 and 255, and X is between 0 and 22. + :paramtype network_block: str + :keyword vcenter_password: Optionally, set the vCenter admin password when the private cloud is + created. + :paramtype vcenter_password: str + :keyword nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is + created. + :paramtype nsxt_password: str + :keyword secondary_circuit: A secondary expressRoute circuit from a separate AZ. Only present + in a stretched private cloud. + :paramtype secondary_circuit: ~azure.mgmt.avs.models.Circuit + """ super(PrivateCloud, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.identity = identity @@ -2018,10 +2316,10 @@ class PrivateCloudIdentity(msrest.serialization.Model): :ivar tenant_id: The tenant ID associated with the private cloud. This property will only be provided for a system assigned identity. :vartype tenant_id: str - :param type: The type of identity used for the private cloud. The type 'SystemAssigned' refers + :ivar type: The type of identity used for the private cloud. The type 'SystemAssigned' refers to an implicitly created identity. The type 'None' will remove any identities from the Private Cloud. Possible values include: "SystemAssigned", "None". - :type type: str or ~azure.mgmt.avs.models.ResourceIdentityType + :vartype type: str or ~azure.mgmt.avs.models.ResourceIdentityType """ _validation = { @@ -2041,6 +2339,12 @@ def __init__( type: Optional[Union[str, "ResourceIdentityType"]] = None, **kwargs ): + """ + :keyword type: The type of identity used for the private cloud. The type 'SystemAssigned' + refers to an implicitly created identity. The type 'None' will remove any identities from the + Private Cloud. Possible values include: "SystemAssigned", "None". + :paramtype type: str or ~azure.mgmt.avs.models.ResourceIdentityType + """ super(PrivateCloudIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -2072,6 +2376,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateCloudList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2080,18 +2386,18 @@ def __init__( class PrivateCloudUpdateProperties(msrest.serialization.Model): """The properties of a private cloud resource that may be updated. - :param management_cluster: The default cluster used for management. - :type management_cluster: ~azure.mgmt.avs.models.ManagementCluster - :param internet: Connectivity to internet is enabled or disabled. Possible values include: + :ivar management_cluster: The default cluster used for management. + :vartype management_cluster: ~azure.mgmt.avs.models.ManagementCluster + :ivar internet: Connectivity to internet is enabled or disabled. Possible values include: "Enabled", "Disabled". Default value: "Disabled". - :type internet: str or ~azure.mgmt.avs.models.InternetEnum - :param identity_sources: vCenter Single Sign On Identity Sources. - :type identity_sources: list[~azure.mgmt.avs.models.IdentitySource] - :param availability: Properties describing how the cloud is distributed across availability + :vartype internet: str or ~azure.mgmt.avs.models.InternetEnum + :ivar identity_sources: vCenter Single Sign On Identity Sources. + :vartype identity_sources: list[~azure.mgmt.avs.models.IdentitySource] + :ivar availability: Properties describing how the cloud is distributed across availability zones. - :type availability: ~azure.mgmt.avs.models.AvailabilityProperties - :param encryption: Customer managed key encryption, can be enabled or disabled. - :type encryption: ~azure.mgmt.avs.models.Encryption + :vartype availability: ~azure.mgmt.avs.models.AvailabilityProperties + :ivar encryption: Customer managed key encryption, can be enabled or disabled. + :vartype encryption: ~azure.mgmt.avs.models.Encryption """ _attribute_map = { @@ -2112,6 +2418,20 @@ def __init__( encryption: Optional["Encryption"] = None, **kwargs ): + """ + :keyword management_cluster: The default cluster used for management. + :paramtype management_cluster: ~azure.mgmt.avs.models.ManagementCluster + :keyword internet: Connectivity to internet is enabled or disabled. Possible values include: + "Enabled", "Disabled". Default value: "Disabled". + :paramtype internet: str or ~azure.mgmt.avs.models.InternetEnum + :keyword identity_sources: vCenter Single Sign On Identity Sources. + :paramtype identity_sources: list[~azure.mgmt.avs.models.IdentitySource] + :keyword availability: Properties describing how the cloud is distributed across availability + zones. + :paramtype availability: ~azure.mgmt.avs.models.AvailabilityProperties + :keyword encryption: Customer managed key encryption, can be enabled or disabled. + :paramtype encryption: ~azure.mgmt.avs.models.Encryption + """ super(PrivateCloudUpdateProperties, self).__init__(**kwargs) self.management_cluster = management_cluster self.internet = internet @@ -2127,29 +2447,29 @@ class PrivateCloudProperties(PrivateCloudUpdateProperties): All required parameters must be populated in order to send to Azure. - :param management_cluster: The default cluster used for management. - :type management_cluster: ~azure.mgmt.avs.models.ManagementCluster - :param internet: Connectivity to internet is enabled or disabled. Possible values include: + :ivar management_cluster: The default cluster used for management. + :vartype management_cluster: ~azure.mgmt.avs.models.ManagementCluster + :ivar internet: Connectivity to internet is enabled or disabled. Possible values include: "Enabled", "Disabled". Default value: "Disabled". - :type internet: str or ~azure.mgmt.avs.models.InternetEnum - :param identity_sources: vCenter Single Sign On Identity Sources. - :type identity_sources: list[~azure.mgmt.avs.models.IdentitySource] - :param availability: Properties describing how the cloud is distributed across availability + :vartype internet: str or ~azure.mgmt.avs.models.InternetEnum + :ivar identity_sources: vCenter Single Sign On Identity Sources. + :vartype identity_sources: list[~azure.mgmt.avs.models.IdentitySource] + :ivar availability: Properties describing how the cloud is distributed across availability zones. - :type availability: ~azure.mgmt.avs.models.AvailabilityProperties - :param encryption: Customer managed key encryption, can be enabled or disabled. - :type encryption: ~azure.mgmt.avs.models.Encryption + :vartype availability: ~azure.mgmt.avs.models.AvailabilityProperties + :ivar encryption: Customer managed key encryption, can be enabled or disabled. + :vartype encryption: ~azure.mgmt.avs.models.Encryption :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", "Failed", "Cancelled", "Pending", "Building", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.PrivateCloudProvisioningState - :param circuit: An ExpressRoute Circuit. - :type circuit: ~azure.mgmt.avs.models.Circuit + :ivar circuit: An ExpressRoute Circuit. + :vartype circuit: ~azure.mgmt.avs.models.Circuit :ivar endpoints: The endpoints. :vartype endpoints: ~azure.mgmt.avs.models.Endpoints - :param network_block: Required. The block of addresses should be unique across VNet in your + :ivar network_block: Required. The block of addresses should be unique across VNet in your subscription as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where A,B,C,D are between 0 and 255, and X is between 0 and 22. - :type network_block: str + :vartype network_block: str :ivar management_network: Network used to access vCenter Server and NSX-T Manager. :vartype management_network: str :ivar provisioning_network: Used for virtual machine cold migration, cloning, and snapshot @@ -2157,21 +2477,21 @@ class PrivateCloudProperties(PrivateCloudUpdateProperties): :vartype provisioning_network: str :ivar vmotion_network: Used for live migration of virtual machines. :vartype vmotion_network: str - :param vcenter_password: Optionally, set the vCenter admin password when the private cloud is + :ivar vcenter_password: Optionally, set the vCenter admin password when the private cloud is created. - :type vcenter_password: str - :param nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is + :vartype vcenter_password: str + :ivar nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is created. - :type nsxt_password: str + :vartype nsxt_password: str :ivar vcenter_certificate_thumbprint: Thumbprint of the vCenter Server SSL certificate. :vartype vcenter_certificate_thumbprint: str :ivar nsxt_certificate_thumbprint: Thumbprint of the NSX-T Manager SSL certificate. :vartype nsxt_certificate_thumbprint: str :ivar external_cloud_links: Array of cloud link IDs from other clouds that connect to this one. :vartype external_cloud_links: list[str] - :param secondary_circuit: A secondary expressRoute circuit from a separate AZ. Only present in - a stretched private cloud. - :type secondary_circuit: ~azure.mgmt.avs.models.Circuit + :ivar secondary_circuit: A secondary expressRoute circuit from a separate AZ. Only present in a + stretched private cloud. + :vartype secondary_circuit: ~azure.mgmt.avs.models.Circuit """ _validation = { @@ -2222,6 +2542,35 @@ def __init__( secondary_circuit: Optional["Circuit"] = None, **kwargs ): + """ + :keyword management_cluster: The default cluster used for management. + :paramtype management_cluster: ~azure.mgmt.avs.models.ManagementCluster + :keyword internet: Connectivity to internet is enabled or disabled. Possible values include: + "Enabled", "Disabled". Default value: "Disabled". + :paramtype internet: str or ~azure.mgmt.avs.models.InternetEnum + :keyword identity_sources: vCenter Single Sign On Identity Sources. + :paramtype identity_sources: list[~azure.mgmt.avs.models.IdentitySource] + :keyword availability: Properties describing how the cloud is distributed across availability + zones. + :paramtype availability: ~azure.mgmt.avs.models.AvailabilityProperties + :keyword encryption: Customer managed key encryption, can be enabled or disabled. + :paramtype encryption: ~azure.mgmt.avs.models.Encryption + :keyword circuit: An ExpressRoute Circuit. + :paramtype circuit: ~azure.mgmt.avs.models.Circuit + :keyword network_block: Required. The block of addresses should be unique across VNet in your + subscription as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where + A,B,C,D are between 0 and 255, and X is between 0 and 22. + :paramtype network_block: str + :keyword vcenter_password: Optionally, set the vCenter admin password when the private cloud is + created. + :paramtype vcenter_password: str + :keyword nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is + created. + :paramtype nsxt_password: str + :keyword secondary_circuit: A secondary expressRoute circuit from a separate AZ. Only present + in a stretched private cloud. + :paramtype secondary_circuit: ~azure.mgmt.avs.models.Circuit + """ super(PrivateCloudProperties, self).__init__(management_cluster=management_cluster, internet=internet, identity_sources=identity_sources, availability=availability, encryption=encryption, **kwargs) self.provisioning_state = None self.circuit = circuit @@ -2241,22 +2590,22 @@ def __init__( class PrivateCloudUpdate(msrest.serialization.Model): """An update to a private cloud resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: The identity of the private cloud, if configured. - :type identity: ~azure.mgmt.avs.models.PrivateCloudIdentity - :param management_cluster: The default cluster used for management. - :type management_cluster: ~azure.mgmt.avs.models.ManagementCluster - :param internet: Connectivity to internet is enabled or disabled. Possible values include: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: The identity of the private cloud, if configured. + :vartype identity: ~azure.mgmt.avs.models.PrivateCloudIdentity + :ivar management_cluster: The default cluster used for management. + :vartype management_cluster: ~azure.mgmt.avs.models.ManagementCluster + :ivar internet: Connectivity to internet is enabled or disabled. Possible values include: "Enabled", "Disabled". Default value: "Disabled". - :type internet: str or ~azure.mgmt.avs.models.InternetEnum - :param identity_sources: vCenter Single Sign On Identity Sources. - :type identity_sources: list[~azure.mgmt.avs.models.IdentitySource] - :param availability: Properties describing how the cloud is distributed across availability + :vartype internet: str or ~azure.mgmt.avs.models.InternetEnum + :ivar identity_sources: vCenter Single Sign On Identity Sources. + :vartype identity_sources: list[~azure.mgmt.avs.models.IdentitySource] + :ivar availability: Properties describing how the cloud is distributed across availability zones. - :type availability: ~azure.mgmt.avs.models.AvailabilityProperties - :param encryption: Customer managed key encryption, can be enabled or disabled. - :type encryption: ~azure.mgmt.avs.models.Encryption + :vartype availability: ~azure.mgmt.avs.models.AvailabilityProperties + :ivar encryption: Customer managed key encryption, can be enabled or disabled. + :vartype encryption: ~azure.mgmt.avs.models.Encryption """ _attribute_map = { @@ -2281,6 +2630,24 @@ def __init__( encryption: Optional["Encryption"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the private cloud, if configured. + :paramtype identity: ~azure.mgmt.avs.models.PrivateCloudIdentity + :keyword management_cluster: The default cluster used for management. + :paramtype management_cluster: ~azure.mgmt.avs.models.ManagementCluster + :keyword internet: Connectivity to internet is enabled or disabled. Possible values include: + "Enabled", "Disabled". Default value: "Disabled". + :paramtype internet: str or ~azure.mgmt.avs.models.InternetEnum + :keyword identity_sources: vCenter Single Sign On Identity Sources. + :paramtype identity_sources: list[~azure.mgmt.avs.models.IdentitySource] + :keyword availability: Properties describing how the cloud is distributed across availability + zones. + :paramtype availability: ~azure.mgmt.avs.models.AvailabilityProperties + :keyword encryption: Customer managed key encryption, can be enabled or disabled. + :paramtype encryption: ~azure.mgmt.avs.models.Encryption + """ super(PrivateCloudUpdate, self).__init__(**kwargs) self.tags = tags self.identity = identity @@ -2320,6 +2687,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -2331,11 +2700,11 @@ class ScriptExecutionParameter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The parameter name. - :type name: str - :param type: Required. The type of execution parameter.Constant filled by server. Possible + :ivar name: Required. The parameter name. + :vartype name: str + :ivar type: Required. The type of execution parameter.Constant filled by server. Possible values include: "Value", "SecureValue", "Credential". - :type type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType + :vartype type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType """ _validation = { @@ -2358,6 +2727,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The parameter name. + :paramtype name: str + """ super(ScriptExecutionParameter, self).__init__(**kwargs) self.name = name self.type = None # type: Optional[str] @@ -2368,15 +2741,15 @@ class PSCredentialExecutionParameter(ScriptExecutionParameter): All required parameters must be populated in order to send to Azure. - :param name: Required. The parameter name. - :type name: str - :param type: Required. The type of execution parameter.Constant filled by server. Possible + :ivar name: Required. The parameter name. + :vartype name: str + :ivar type: Required. The type of execution parameter.Constant filled by server. Possible values include: "Value", "SecureValue", "Credential". - :type type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType - :param username: username for login. - :type username: str - :param password: password for login. - :type password: str + :vartype type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType + :ivar username: username for login. + :vartype username: str + :ivar password: password for login. + :vartype password: str """ _validation = { @@ -2399,6 +2772,14 @@ def __init__( password: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. The parameter name. + :paramtype name: str + :keyword username: username for login. + :paramtype username: str + :keyword password: password for login. + :paramtype password: str + """ super(PSCredentialExecutionParameter, self).__init__(name=name, **kwargs) self.type = 'Credential' # type: str self.username = username @@ -2431,6 +2812,8 @@ def __init__( self, **kwargs ): + """ + """ super(Quota, self).__init__(**kwargs) self.hosts_remaining = None self.quota_enabled = None @@ -2477,6 +2860,8 @@ def __init__( self, **kwargs ): + """ + """ super(ScriptCmdlet, self).__init__(**kwargs) self.description = None self.timeout = None @@ -2508,6 +2893,8 @@ def __init__( self, **kwargs ): + """ + """ super(ScriptCmdletsList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2524,22 +2911,21 @@ class ScriptExecution(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param script_cmdlet_id: A reference to the script cmdlet resource if user is running a AVS + :ivar script_cmdlet_id: A reference to the script cmdlet resource if user is running a AVS script. - :type script_cmdlet_id: str - :param parameters: Parameters the script will accept. - :type parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter] - :param hidden_parameters: Parameters that will be hidden/not visible to ARM, such as passwords + :vartype script_cmdlet_id: str + :ivar parameters: Parameters the script will accept. + :vartype parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter] + :ivar hidden_parameters: Parameters that will be hidden/not visible to ARM, such as passwords and credentials. - :type hidden_parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter] - :param failure_reason: Error message if the script was able to run, but if the script itself - had errors or powershell threw an exception. - :type failure_reason: str - :param timeout: Time limit for execution. - :type timeout: str - :param retention: Time to live for the resource. If not provided, will be available for 60 - days. - :type retention: str + :vartype hidden_parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter] + :ivar failure_reason: Error message if the script was able to run, but if the script itself had + errors or powershell threw an exception. + :vartype failure_reason: str + :ivar timeout: Time limit for execution. + :vartype timeout: str + :ivar retention: Time to live for the resource. If not provided, will be available for 60 days. + :vartype retention: str :ivar submitted_at: Time the script execution was submitted. :vartype submitted_at: ~datetime.datetime :ivar started_at: Time the script execution was started. @@ -2549,10 +2935,10 @@ class ScriptExecution(ProxyResource): :ivar provisioning_state: The state of the script execution resource. Possible values include: "Pending", "Running", "Succeeded", "Failed", "Cancelling", "Cancelled", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.avs.models.ScriptExecutionProvisioningState - :param output: Standard output stream from the powershell execution. - :type output: list[str] - :param named_outputs: User-defined dictionary. - :type named_outputs: dict[str, any] + :ivar output: Standard output stream from the powershell execution. + :vartype output: list[str] + :ivar named_outputs: User-defined dictionary. + :vartype named_outputs: dict[str, any] :ivar information: Standard information out stream from the powershell execution. :vartype information: list[str] :ivar warnings: Standard warning out stream from the powershell execution. @@ -2608,6 +2994,28 @@ def __init__( named_outputs: Optional[Dict[str, Any]] = None, **kwargs ): + """ + :keyword script_cmdlet_id: A reference to the script cmdlet resource if user is running a AVS + script. + :paramtype script_cmdlet_id: str + :keyword parameters: Parameters the script will accept. + :paramtype parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter] + :keyword hidden_parameters: Parameters that will be hidden/not visible to ARM, such as + passwords and credentials. + :paramtype hidden_parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter] + :keyword failure_reason: Error message if the script was able to run, but if the script itself + had errors or powershell threw an exception. + :paramtype failure_reason: str + :keyword timeout: Time limit for execution. + :paramtype timeout: str + :keyword retention: Time to live for the resource. If not provided, will be available for 60 + days. + :paramtype retention: str + :keyword output: Standard output stream from the powershell execution. + :paramtype output: list[str] + :keyword named_outputs: User-defined dictionary. + :paramtype named_outputs: dict[str, any] + """ super(ScriptExecution, self).__init__(**kwargs) self.script_cmdlet_id = script_cmdlet_id self.parameters = parameters @@ -2651,6 +3059,8 @@ def __init__( self, **kwargs ): + """ + """ super(ScriptExecutionsList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2693,6 +3103,8 @@ def __init__( self, **kwargs ): + """ + """ super(ScriptPackage, self).__init__(**kwargs) self.description = None self.version = None @@ -2723,6 +3135,8 @@ def __init__( self, **kwargs ): + """ + """ super(ScriptPackagesList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2737,8 +3151,8 @@ class ScriptParameter(msrest.serialization.Model): PSCredentialObject. Possible values include: "String", "SecureString", "Credential", "Int", "Bool", "Float". :vartype type: str or ~azure.mgmt.avs.models.ScriptParameterTypes - :param name: The parameter name that the script will expect a parameter value for. - :type name: str + :ivar name: The parameter name that the script will expect a parameter value for. + :vartype name: str :ivar description: User friendly description of the parameter. :vartype description: str :ivar visibility: Should this parameter be visible to arm and passed in the parameters argument @@ -2770,6 +3184,10 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword name: The parameter name that the script will expect a parameter value for. + :paramtype name: str + """ super(ScriptParameter, self).__init__(**kwargs) self.type = None self.name = name @@ -2783,13 +3201,13 @@ class ScriptSecureStringExecutionParameter(ScriptExecutionParameter): All required parameters must be populated in order to send to Azure. - :param name: Required. The parameter name. - :type name: str - :param type: Required. The type of execution parameter.Constant filled by server. Possible + :ivar name: Required. The parameter name. + :vartype name: str + :ivar type: Required. The type of execution parameter.Constant filled by server. Possible values include: "Value", "SecureValue", "Credential". - :type type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType - :param secure_value: A secure value for the passed parameter, not to be stored in logs. - :type secure_value: str + :vartype type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType + :ivar secure_value: A secure value for the passed parameter, not to be stored in logs. + :vartype secure_value: str """ _validation = { @@ -2810,6 +3228,12 @@ def __init__( secure_value: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. The parameter name. + :paramtype name: str + :keyword secure_value: A secure value for the passed parameter, not to be stored in logs. + :paramtype secure_value: str + """ super(ScriptSecureStringExecutionParameter, self).__init__(name=name, **kwargs) self.type = 'SecureValue' # type: str self.secure_value = secure_value @@ -2820,13 +3244,13 @@ class ScriptStringExecutionParameter(ScriptExecutionParameter): All required parameters must be populated in order to send to Azure. - :param name: Required. The parameter name. - :type name: str - :param type: Required. The type of execution parameter.Constant filled by server. Possible + :ivar name: Required. The parameter name. + :vartype name: str + :ivar type: Required. The type of execution parameter.Constant filled by server. Possible values include: "Value", "SecureValue", "Credential". - :type type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType - :param value: The value for the passed parameter. - :type value: str + :vartype type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType + :ivar value: The value for the passed parameter. + :vartype value: str """ _validation = { @@ -2847,6 +3271,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. The parameter name. + :paramtype name: str + :keyword value: The value for the passed parameter. + :paramtype value: str + """ super(ScriptStringExecutionParameter, self).__init__(name=name, **kwargs) self.type = 'Value' # type: str self.value = value @@ -2855,10 +3285,10 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring. - :type log_specifications: list[~azure.mgmt.avs.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure Monitoring. - :type metric_specifications: list[~azure.mgmt.avs.models.MetricSpecification] + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.avs.models.LogSpecification] + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: list[~azure.mgmt.avs.models.MetricSpecification] """ _attribute_map = { @@ -2873,6 +3303,12 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: list[~azure.mgmt.avs.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: list[~azure.mgmt.avs.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications @@ -2883,8 +3319,8 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the SKU. - :type name: str + :ivar name: Required. The name of the SKU. + :vartype name: str """ _validation = { @@ -2901,6 +3337,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The name of the SKU. + :paramtype name: str + """ super(Sku, self).__init__(**kwargs) self.name = name @@ -2931,6 +3371,8 @@ def __init__( self, **kwargs ): + """ + """ super(Trial, self).__init__(**kwargs) self.status = None self.available_hosts = None @@ -2983,6 +3425,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachine, self).__init__(**kwargs) self.display_name = None self.mo_ref_id = None @@ -2993,9 +3437,9 @@ def __init__( class VirtualMachineRestrictMovement(msrest.serialization.Model): """Set VM DRS-driven movement to restricted (enabled) or not (disabled). - :param restrict_movement: Whether VM DRS-driven movement is restricted (enabled) or not + :ivar restrict_movement: Whether VM DRS-driven movement is restricted (enabled) or not (disabled). Possible values include: "Enabled", "Disabled". - :type restrict_movement: str or ~azure.mgmt.avs.models.VirtualMachineRestrictMovementState + :vartype restrict_movement: str or ~azure.mgmt.avs.models.VirtualMachineRestrictMovementState """ _attribute_map = { @@ -3008,6 +3452,11 @@ def __init__( restrict_movement: Optional[Union[str, "VirtualMachineRestrictMovementState"]] = None, **kwargs ): + """ + :keyword restrict_movement: Whether VM DRS-driven movement is restricted (enabled) or not + (disabled). Possible values include: "Enabled", "Disabled". + :paramtype restrict_movement: str or ~azure.mgmt.avs.models.VirtualMachineRestrictMovementState + """ super(VirtualMachineRestrictMovement, self).__init__(**kwargs) self.restrict_movement = restrict_movement @@ -3037,6 +3486,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachinesList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3049,24 +3500,24 @@ class VmHostPlacementPolicyProperties(PlacementPolicyProperties): All required parameters must be populated in order to send to Azure. - :param type: Required. placement policy type.Constant filled by server. Possible values - include: "VmVm", "VmHost". - :type type: str or ~azure.mgmt.avs.models.PlacementPolicyType - :param state: Whether the placement policy is enabled or disabled. Possible values include: + :ivar type: Required. placement policy type.Constant filled by server. Possible values include: + "VmVm", "VmHost". + :vartype type: str or ~azure.mgmt.avs.models.PlacementPolicyType + :ivar state: Whether the placement policy is enabled or disabled. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.avs.models.PlacementPolicyState - :param display_name: Display name of the placement policy. - :type display_name: str + :vartype state: str or ~azure.mgmt.avs.models.PlacementPolicyState + :ivar display_name: Display name of the placement policy. + :vartype display_name: str :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", "Failed", "Building", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.PlacementPolicyProvisioningState - :param vm_members: Required. Virtual machine members list. - :type vm_members: list[str] - :param host_members: Required. Host members list. - :type host_members: list[str] - :param affinity_type: Required. placement policy affinity type. Possible values include: + :ivar vm_members: Required. Virtual machine members list. + :vartype vm_members: list[str] + :ivar host_members: Required. Host members list. + :vartype host_members: list[str] + :ivar affinity_type: Required. placement policy affinity type. Possible values include: "Affinity", "AntiAffinity". - :type affinity_type: str or ~azure.mgmt.avs.models.AffinityType + :vartype affinity_type: str or ~azure.mgmt.avs.models.AffinityType """ _validation = { @@ -3097,6 +3548,20 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword state: Whether the placement policy is enabled or disabled. Possible values include: + "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.avs.models.PlacementPolicyState + :keyword display_name: Display name of the placement policy. + :paramtype display_name: str + :keyword vm_members: Required. Virtual machine members list. + :paramtype vm_members: list[str] + :keyword host_members: Required. Host members list. + :paramtype host_members: list[str] + :keyword affinity_type: Required. placement policy affinity type. Possible values include: + "Affinity", "AntiAffinity". + :paramtype affinity_type: str or ~azure.mgmt.avs.models.AffinityType + """ super(VmHostPlacementPolicyProperties, self).__init__(state=state, display_name=display_name, **kwargs) self.type = 'VmHost' # type: str self.vm_members = vm_members @@ -3111,22 +3576,22 @@ class VmPlacementPolicyProperties(PlacementPolicyProperties): All required parameters must be populated in order to send to Azure. - :param type: Required. placement policy type.Constant filled by server. Possible values - include: "VmVm", "VmHost". - :type type: str or ~azure.mgmt.avs.models.PlacementPolicyType - :param state: Whether the placement policy is enabled or disabled. Possible values include: + :ivar type: Required. placement policy type.Constant filled by server. Possible values include: + "VmVm", "VmHost". + :vartype type: str or ~azure.mgmt.avs.models.PlacementPolicyType + :ivar state: Whether the placement policy is enabled or disabled. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.avs.models.PlacementPolicyState - :param display_name: Display name of the placement policy. - :type display_name: str + :vartype state: str or ~azure.mgmt.avs.models.PlacementPolicyState + :ivar display_name: Display name of the placement policy. + :vartype display_name: str :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", "Failed", "Building", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.PlacementPolicyProvisioningState - :param vm_members: Required. Virtual machine members list. - :type vm_members: list[str] - :param affinity_type: Required. placement policy affinity type. Possible values include: + :ivar vm_members: Required. Virtual machine members list. + :vartype vm_members: list[str] + :ivar affinity_type: Required. placement policy affinity type. Possible values include: "Affinity", "AntiAffinity". - :type affinity_type: str or ~azure.mgmt.avs.models.AffinityType + :vartype affinity_type: str or ~azure.mgmt.avs.models.AffinityType """ _validation = { @@ -3154,6 +3619,18 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword state: Whether the placement policy is enabled or disabled. Possible values include: + "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.avs.models.PlacementPolicyState + :keyword display_name: Display name of the placement policy. + :paramtype display_name: str + :keyword vm_members: Required. Virtual machine members list. + :paramtype vm_members: list[str] + :keyword affinity_type: Required. placement policy affinity type. Possible values include: + "Affinity", "AntiAffinity". + :paramtype affinity_type: str or ~azure.mgmt.avs.models.AffinityType + """ super(VmPlacementPolicyProperties, self).__init__(state=state, display_name=display_name, **kwargs) self.type = 'VmVm' # type: str self.vm_members = vm_members @@ -3171,8 +3648,8 @@ class WorkloadNetworkDhcp(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param properties: DHCP properties. - :type properties: ~azure.mgmt.avs.models.WorkloadNetworkDhcpEntity + :ivar properties: DHCP properties. + :vartype properties: ~azure.mgmt.avs.models.WorkloadNetworkDhcpEntity """ _validation = { @@ -3194,6 +3671,10 @@ def __init__( properties: Optional["WorkloadNetworkDhcpEntity"] = None, **kwargs ): + """ + :keyword properties: DHCP properties. + :paramtype properties: ~azure.mgmt.avs.models.WorkloadNetworkDhcpEntity + """ super(WorkloadNetworkDhcp, self).__init__(**kwargs) self.properties = properties @@ -3208,18 +3689,18 @@ class WorkloadNetworkDhcpEntity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param dhcp_type: Required. Type of DHCP: SERVER or RELAY.Constant filled by server. Possible + :ivar dhcp_type: Required. Type of DHCP: SERVER or RELAY.Constant filled by server. Possible values include: "SERVER", "RELAY". - :type dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum - :param display_name: Display name of the DHCP entity. - :type display_name: str + :vartype dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum + :ivar display_name: Display name of the DHCP entity. + :vartype display_name: str :ivar segments: NSX Segments consuming DHCP. :vartype segments: list[str] :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", "Failed", "Building", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState - :param revision: NSX revision number. - :type revision: long + :ivar revision: NSX revision number. + :vartype revision: long """ _validation = { @@ -3247,6 +3728,12 @@ def __init__( revision: Optional[int] = None, **kwargs ): + """ + :keyword display_name: Display name of the DHCP entity. + :paramtype display_name: str + :keyword revision: NSX revision number. + :paramtype revision: long + """ super(WorkloadNetworkDhcpEntity, self).__init__(**kwargs) self.dhcp_type = None # type: Optional[str] self.display_name = display_name @@ -3280,6 +3767,8 @@ def __init__( self, **kwargs ): + """ + """ super(WorkloadNetworkDhcpList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3292,20 +3781,20 @@ class WorkloadNetworkDhcpRelay(WorkloadNetworkDhcpEntity): All required parameters must be populated in order to send to Azure. - :param dhcp_type: Required. Type of DHCP: SERVER or RELAY.Constant filled by server. Possible + :ivar dhcp_type: Required. Type of DHCP: SERVER or RELAY.Constant filled by server. Possible values include: "SERVER", "RELAY". - :type dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum - :param display_name: Display name of the DHCP entity. - :type display_name: str + :vartype dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum + :ivar display_name: Display name of the DHCP entity. + :vartype display_name: str :ivar segments: NSX Segments consuming DHCP. :vartype segments: list[str] :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", "Failed", "Building", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState - :param revision: NSX revision number. - :type revision: long - :param server_addresses: DHCP Relay Addresses. Max 3. - :type server_addresses: list[str] + :ivar revision: NSX revision number. + :vartype revision: long + :ivar server_addresses: DHCP Relay Addresses. Max 3. + :vartype server_addresses: list[str] """ _validation = { @@ -3332,6 +3821,14 @@ def __init__( server_addresses: Optional[List[str]] = None, **kwargs ): + """ + :keyword display_name: Display name of the DHCP entity. + :paramtype display_name: str + :keyword revision: NSX revision number. + :paramtype revision: long + :keyword server_addresses: DHCP Relay Addresses. Max 3. + :paramtype server_addresses: list[str] + """ super(WorkloadNetworkDhcpRelay, self).__init__(display_name=display_name, revision=revision, **kwargs) self.dhcp_type = 'RELAY' # type: str self.server_addresses = server_addresses @@ -3344,22 +3841,22 @@ class WorkloadNetworkDhcpServer(WorkloadNetworkDhcpEntity): All required parameters must be populated in order to send to Azure. - :param dhcp_type: Required. Type of DHCP: SERVER or RELAY.Constant filled by server. Possible + :ivar dhcp_type: Required. Type of DHCP: SERVER or RELAY.Constant filled by server. Possible values include: "SERVER", "RELAY". - :type dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum - :param display_name: Display name of the DHCP entity. - :type display_name: str + :vartype dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum + :ivar display_name: Display name of the DHCP entity. + :vartype display_name: str :ivar segments: NSX Segments consuming DHCP. :vartype segments: list[str] :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", "Failed", "Building", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState - :param revision: NSX revision number. - :type revision: long - :param server_address: DHCP Server Address. - :type server_address: str - :param lease_time: DHCP Server Lease Time. - :type lease_time: long + :ivar revision: NSX revision number. + :vartype revision: long + :ivar server_address: DHCP Server Address. + :vartype server_address: str + :ivar lease_time: DHCP Server Lease Time. + :vartype lease_time: long """ _validation = { @@ -3387,6 +3884,16 @@ def __init__( lease_time: Optional[int] = None, **kwargs ): + """ + :keyword display_name: Display name of the DHCP entity. + :paramtype display_name: str + :keyword revision: NSX revision number. + :paramtype revision: long + :keyword server_address: DHCP Server Address. + :paramtype server_address: str + :keyword lease_time: DHCP Server Lease Time. + :paramtype lease_time: long + """ super(WorkloadNetworkDhcpServer, self).__init__(display_name=display_name, revision=revision, **kwargs) self.dhcp_type = 'SERVER' # type: str self.server_address = server_address @@ -3404,25 +3911,25 @@ class WorkloadNetworkDnsService(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param display_name: Display name of the DNS Service. - :type display_name: str - :param dns_service_ip: DNS service IP of the DNS Service. - :type dns_service_ip: str - :param default_dns_zone: Default DNS zone of the DNS Service. - :type default_dns_zone: str - :param fqdn_zones: FQDN zones of the DNS Service. - :type fqdn_zones: list[str] - :param log_level: DNS Service log level. Possible values include: "DEBUG", "INFO", "WARNING", + :ivar display_name: Display name of the DNS Service. + :vartype display_name: str + :ivar dns_service_ip: DNS service IP of the DNS Service. + :vartype dns_service_ip: str + :ivar default_dns_zone: Default DNS zone of the DNS Service. + :vartype default_dns_zone: str + :ivar fqdn_zones: FQDN zones of the DNS Service. + :vartype fqdn_zones: list[str] + :ivar log_level: DNS Service log level. Possible values include: "DEBUG", "INFO", "WARNING", "ERROR", "FATAL". - :type log_level: str or ~azure.mgmt.avs.models.DnsServiceLogLevelEnum + :vartype log_level: str or ~azure.mgmt.avs.models.DnsServiceLogLevelEnum :ivar status: DNS Service status. Possible values include: "SUCCESS", "FAILURE". :vartype status: str or ~azure.mgmt.avs.models.DnsServiceStatusEnum :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", "Failed", "Building", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDnsServiceProvisioningState - :param revision: NSX revision number. - :type revision: long + :ivar revision: NSX revision number. + :vartype revision: long """ _validation = { @@ -3458,6 +3965,21 @@ def __init__( revision: Optional[int] = None, **kwargs ): + """ + :keyword display_name: Display name of the DNS Service. + :paramtype display_name: str + :keyword dns_service_ip: DNS service IP of the DNS Service. + :paramtype dns_service_ip: str + :keyword default_dns_zone: Default DNS zone of the DNS Service. + :paramtype default_dns_zone: str + :keyword fqdn_zones: FQDN zones of the DNS Service. + :paramtype fqdn_zones: list[str] + :keyword log_level: DNS Service log level. Possible values include: "DEBUG", "INFO", "WARNING", + "ERROR", "FATAL". + :paramtype log_level: str or ~azure.mgmt.avs.models.DnsServiceLogLevelEnum + :keyword revision: NSX revision number. + :paramtype revision: long + """ super(WorkloadNetworkDnsService, self).__init__(**kwargs) self.display_name = display_name self.dns_service_ip = dns_service_ip @@ -3494,6 +4016,8 @@ def __init__( self, **kwargs ): + """ + """ super(WorkloadNetworkDnsServicesList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3510,22 +4034,22 @@ class WorkloadNetworkDnsZone(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param display_name: Display name of the DNS Zone. - :type display_name: str - :param domain: Domain names of the DNS Zone. - :type domain: list[str] - :param dns_server_ips: DNS Server IP array of the DNS Zone. - :type dns_server_ips: list[str] - :param source_ip: Source IP of the DNS Zone. - :type source_ip: str - :param dns_services: Number of DNS Services using the DNS zone. - :type dns_services: long + :ivar display_name: Display name of the DNS Zone. + :vartype display_name: str + :ivar domain: Domain names of the DNS Zone. + :vartype domain: list[str] + :ivar dns_server_ips: DNS Server IP array of the DNS Zone. + :vartype dns_server_ips: list[str] + :ivar source_ip: Source IP of the DNS Zone. + :vartype source_ip: str + :ivar dns_services: Number of DNS Services using the DNS zone. + :vartype dns_services: long :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", "Failed", "Building", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDnsZoneProvisioningState - :param revision: NSX revision number. - :type revision: long + :ivar revision: NSX revision number. + :vartype revision: long """ _validation = { @@ -3559,6 +4083,20 @@ def __init__( revision: Optional[int] = None, **kwargs ): + """ + :keyword display_name: Display name of the DNS Zone. + :paramtype display_name: str + :keyword domain: Domain names of the DNS Zone. + :paramtype domain: list[str] + :keyword dns_server_ips: DNS Server IP array of the DNS Zone. + :paramtype dns_server_ips: list[str] + :keyword source_ip: Source IP of the DNS Zone. + :paramtype source_ip: str + :keyword dns_services: Number of DNS Services using the DNS zone. + :paramtype dns_services: long + :keyword revision: NSX revision number. + :paramtype revision: long + """ super(WorkloadNetworkDnsZone, self).__init__(**kwargs) self.display_name = display_name self.domain = domain @@ -3594,6 +4132,8 @@ def __init__( self, **kwargs ): + """ + """ super(WorkloadNetworkDnsZonesList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3610,8 +4150,8 @@ class WorkloadNetworkGateway(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param display_name: Display name of the DHCP entity. - :type display_name: str + :ivar display_name: Display name of the DHCP entity. + :vartype display_name: str :ivar path: NSX Gateway Path. :vartype path: str """ @@ -3637,6 +4177,10 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword display_name: Display name of the DHCP entity. + :paramtype display_name: str + """ super(WorkloadNetworkGateway, self).__init__(**kwargs) self.display_name = display_name self.path = None @@ -3667,6 +4211,8 @@ def __init__( self, **kwargs ): + """ + """ super(WorkloadNetworkGatewayList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3683,23 +4229,23 @@ class WorkloadNetworkPortMirroring(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param display_name: Display name of the port mirroring profile. - :type display_name: str - :param direction: Direction of port mirroring profile. Possible values include: "INGRESS", + :ivar display_name: Display name of the port mirroring profile. + :vartype display_name: str + :ivar direction: Direction of port mirroring profile. Possible values include: "INGRESS", "EGRESS", "BIDIRECTIONAL". - :type direction: str or ~azure.mgmt.avs.models.PortMirroringDirectionEnum - :param source: Source VM Group. - :type source: str - :param destination: Destination VM Group. - :type destination: str + :vartype direction: str or ~azure.mgmt.avs.models.PortMirroringDirectionEnum + :ivar source: Source VM Group. + :vartype source: str + :ivar destination: Destination VM Group. + :vartype destination: str :ivar status: Port Mirroring Status. Possible values include: "SUCCESS", "FAILURE". :vartype status: str or ~azure.mgmt.avs.models.PortMirroringStatusEnum :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", "Failed", "Building", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkPortMirroringProvisioningState - :param revision: NSX revision number. - :type revision: long + :ivar revision: NSX revision number. + :vartype revision: long """ _validation = { @@ -3733,6 +4279,19 @@ def __init__( revision: Optional[int] = None, **kwargs ): + """ + :keyword display_name: Display name of the port mirroring profile. + :paramtype display_name: str + :keyword direction: Direction of port mirroring profile. Possible values include: "INGRESS", + "EGRESS", "BIDIRECTIONAL". + :paramtype direction: str or ~azure.mgmt.avs.models.PortMirroringDirectionEnum + :keyword source: Source VM Group. + :paramtype source: str + :keyword destination: Destination VM Group. + :paramtype destination: str + :keyword revision: NSX revision number. + :paramtype revision: long + """ super(WorkloadNetworkPortMirroring, self).__init__(**kwargs) self.display_name = display_name self.direction = direction @@ -3768,6 +4327,8 @@ def __init__( self, **kwargs ): + """ + """ super(WorkloadNetworkPortMirroringList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3784,10 +4345,10 @@ class WorkloadNetworkPublicIP(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param display_name: Display name of the Public IP Block. - :type display_name: str - :param number_of_public_i_ps: Number of Public IPs requested. - :type number_of_public_i_ps: long + :ivar display_name: Display name of the Public IP Block. + :vartype display_name: str + :ivar number_of_public_i_ps: Number of Public IPs requested. + :vartype number_of_public_i_ps: long :ivar public_ip_block: CIDR Block of the Public IP Block. :vartype public_ip_block: str :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", @@ -3821,6 +4382,12 @@ def __init__( number_of_public_i_ps: Optional[int] = None, **kwargs ): + """ + :keyword display_name: Display name of the Public IP Block. + :paramtype display_name: str + :keyword number_of_public_i_ps: Number of Public IPs requested. + :paramtype number_of_public_i_ps: long + """ super(WorkloadNetworkPublicIP, self).__init__(**kwargs) self.display_name = display_name self.number_of_public_i_ps = number_of_public_i_ps @@ -3853,6 +4420,8 @@ def __init__( self, **kwargs ): + """ + """ super(WorkloadNetworkPublicIPsList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3869,12 +4438,12 @@ class WorkloadNetworkSegment(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param display_name: Display name of the segment. - :type display_name: str - :param connected_gateway: Gateway which to connect segment to. - :type connected_gateway: str - :param subnet: Subnet which to connect segment to. - :type subnet: ~azure.mgmt.avs.models.WorkloadNetworkSegmentSubnet + :ivar display_name: Display name of the segment. + :vartype display_name: str + :ivar connected_gateway: Gateway which to connect segment to. + :vartype connected_gateway: str + :ivar subnet: Subnet which to connect segment to. + :vartype subnet: ~azure.mgmt.avs.models.WorkloadNetworkSegmentSubnet :ivar port_vif: Port Vif which segment is associated with. :vartype port_vif: list[~azure.mgmt.avs.models.WorkloadNetworkSegmentPortVif] :ivar status: Segment status. Possible values include: "SUCCESS", "FAILURE". @@ -3883,8 +4452,8 @@ class WorkloadNetworkSegment(ProxyResource): "Failed", "Building", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkSegmentProvisioningState - :param revision: NSX revision number. - :type revision: long + :ivar revision: NSX revision number. + :vartype revision: long """ _validation = { @@ -3918,6 +4487,16 @@ def __init__( revision: Optional[int] = None, **kwargs ): + """ + :keyword display_name: Display name of the segment. + :paramtype display_name: str + :keyword connected_gateway: Gateway which to connect segment to. + :paramtype connected_gateway: str + :keyword subnet: Subnet which to connect segment to. + :paramtype subnet: ~azure.mgmt.avs.models.WorkloadNetworkSegmentSubnet + :keyword revision: NSX revision number. + :paramtype revision: long + """ super(WorkloadNetworkSegment, self).__init__(**kwargs) self.display_name = display_name self.connected_gateway = connected_gateway @@ -3931,8 +4510,8 @@ def __init__( class WorkloadNetworkSegmentPortVif(msrest.serialization.Model): """Ports and any VIF attached to segment. - :param port_name: Name of port or VIF attached to segment. - :type port_name: str + :ivar port_name: Name of port or VIF attached to segment. + :vartype port_name: str """ _attribute_map = { @@ -3945,6 +4524,10 @@ def __init__( port_name: Optional[str] = None, **kwargs ): + """ + :keyword port_name: Name of port or VIF attached to segment. + :paramtype port_name: str + """ super(WorkloadNetworkSegmentPortVif, self).__init__(**kwargs) self.port_name = port_name @@ -3974,6 +4557,8 @@ def __init__( self, **kwargs ): + """ + """ super(WorkloadNetworkSegmentsList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3982,10 +4567,10 @@ def __init__( class WorkloadNetworkSegmentSubnet(msrest.serialization.Model): """Subnet configuration for segment. - :param dhcp_ranges: DHCP Range assigned for subnet. - :type dhcp_ranges: list[str] - :param gateway_address: Gateway address. - :type gateway_address: str + :ivar dhcp_ranges: DHCP Range assigned for subnet. + :vartype dhcp_ranges: list[str] + :ivar gateway_address: Gateway address. + :vartype gateway_address: str """ _attribute_map = { @@ -4000,6 +4585,12 @@ def __init__( gateway_address: Optional[str] = None, **kwargs ): + """ + :keyword dhcp_ranges: DHCP Range assigned for subnet. + :paramtype dhcp_ranges: list[str] + :keyword gateway_address: Gateway address. + :paramtype gateway_address: str + """ super(WorkloadNetworkSegmentSubnet, self).__init__(**kwargs) self.dhcp_ranges = dhcp_ranges self.gateway_address = gateway_address @@ -4016,8 +4607,8 @@ class WorkloadNetworkVirtualMachine(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param display_name: Display name of the VM. - :type display_name: str + :ivar display_name: Display name of the VM. + :vartype display_name: str :ivar vm_type: Virtual machine type. Possible values include: "REGULAR", "EDGE", "SERVICE". :vartype vm_type: str or ~azure.mgmt.avs.models.VMTypeEnum """ @@ -4043,6 +4634,10 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword display_name: Display name of the VM. + :paramtype display_name: str + """ super(WorkloadNetworkVirtualMachine, self).__init__(**kwargs) self.display_name = display_name self.vm_type = None @@ -4073,6 +4668,8 @@ def __init__( self, **kwargs ): + """ + """ super(WorkloadNetworkVirtualMachinesList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4089,18 +4686,18 @@ class WorkloadNetworkVMGroup(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param display_name: Display name of the VM group. - :type display_name: str - :param members: Virtual machine members of this group. - :type members: list[str] + :ivar display_name: Display name of the VM group. + :vartype display_name: str + :ivar members: Virtual machine members of this group. + :vartype members: list[str] :ivar status: VM Group status. Possible values include: "SUCCESS", "FAILURE". :vartype status: str or ~azure.mgmt.avs.models.VMGroupStatusEnum :ivar provisioning_state: The provisioning state. Possible values include: "Succeeded", "Failed", "Building", "Deleting", "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkVMGroupProvisioningState - :param revision: NSX revision number. - :type revision: long + :ivar revision: NSX revision number. + :vartype revision: long """ _validation = { @@ -4130,6 +4727,14 @@ def __init__( revision: Optional[int] = None, **kwargs ): + """ + :keyword display_name: Display name of the VM group. + :paramtype display_name: str + :keyword members: Virtual machine members of this group. + :paramtype members: list[str] + :keyword revision: NSX revision number. + :paramtype revision: long + """ super(WorkloadNetworkVMGroup, self).__init__(**kwargs) self.display_name = display_name self.members = members @@ -4163,6 +4768,8 @@ def __init__( self, **kwargs ): + """ + """ super(WorkloadNetworkVMGroupsList, self).__init__(**kwargs) self.value = None self.next_link = None diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_addons_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_addons_operations.py index 2611dffafbf3..f4564a9ae382 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_addons_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_addons_operations.py @@ -5,25 +5,183 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + addon_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "addonName": _SERIALIZER.url("addon_name", addon_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + addon_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "addonName": _SERIALIZER.url("addon_name", addon_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + addon_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "addonName": _SERIALIZER.url("addon_name", addon_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AddonsOperations(object): """AddonsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AddonList"] + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> Iterable["_models.AddonList"]: """List addons in a private cloud. List addons in a private cloud. @@ -72,36 +230,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AddonList', pipeline_response) + deserialized = self._deserialize("AddonList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +274,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - private_cloud_name, # type: str - addon_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Addon" + resource_group_name: str, + private_cloud_name: str, + addon_name: str, + **kwargs: Any + ) -> "_models.Addon": """Get an addon by name in a private cloud. Get an addon by name in a private cloud. @@ -152,28 +308,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + addon_name=addon_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +333,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - addon_name, # type: str - addon, # type: "_models.Addon" - **kwargs # type: Any - ): - # type: (...) -> "_models.Addon" + resource_group_name: str, + private_cloud_name: str, + addon_name: str, + addon: "_models.Addon", + **kwargs: Any + ) -> "_models.Addon": cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(addon, 'Addon') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + addon_name=addon_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(addon, 'Addon') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,17 +384,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - private_cloud_name, # type: str - addon_name, # type: str - addon, # type: "_models.Addon" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Addon"] + resource_group_name: str, + private_cloud_name: str, + addon_name: str, + addon: "_models.Addon", + **kwargs: Any + ) -> LROPoller["_models.Addon"]: """Create or update a addon in a private cloud. Create or update a addon in a private cloud. @@ -272,15 +411,18 @@ def begin_create_or_update( :type addon: ~azure.mgmt.avs.models.Addon :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Addon or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Addon] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,28 +435,21 @@ def begin_create_or_update( private_cloud_name=private_cloud_name, addon_name=addon_name, addon=addon, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('Addon', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -326,43 +461,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - addon_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + private_cloud_name: str, + addon_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + addon_name=addon_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -375,14 +500,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - private_cloud_name, # type: str - addon_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + private_cloud_name: str, + addon_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a addon in a private cloud. Delete a addon in a private cloud. @@ -395,15 +521,17 @@ def begin_delete( :type addon_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,22 +546,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -445,4 +565,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_authorizations_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_authorizations_operations.py index 87ba55b46207..2dabc21b41bd 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_authorizations_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_authorizations_operations.py @@ -5,25 +5,183 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + authorization_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "authorizationName": _SERIALIZER.url("authorization_name", authorization_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + authorization_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "authorizationName": _SERIALIZER.url("authorization_name", authorization_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + authorization_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "authorizationName": _SERIALIZER.url("authorization_name", authorization_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AuthorizationsOperations(object): """AuthorizationsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExpressRouteAuthorizationList"] + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> Iterable["_models.ExpressRouteAuthorizationList"]: """List ExpressRoute Circuit Authorizations in a private cloud. List ExpressRoute Circuit Authorizations in a private cloud. @@ -63,7 +221,8 @@ def list( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExpressRouteAuthorizationList or the result of cls(response) + :return: An iterator like instance of either ExpressRouteAuthorizationList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.ExpressRouteAuthorizationList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -72,36 +231,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExpressRouteAuthorizationList', pipeline_response) + deserialized = self._deserialize("ExpressRouteAuthorizationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +275,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - private_cloud_name, # type: str - authorization_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ExpressRouteAuthorization" + resource_group_name: str, + private_cloud_name: str, + authorization_name: str, + **kwargs: Any + ) -> "_models.ExpressRouteAuthorization": """Get an ExpressRoute Circuit Authorization by name in a private cloud. Get an ExpressRoute Circuit Authorization by name in a private cloud. @@ -152,28 +309,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'authorizationName': self._serialize.url("authorization_name", authorization_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + authorization_name=authorization_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +334,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - authorization_name, # type: str - authorization, # type: "_models.ExpressRouteAuthorization" - **kwargs # type: Any - ): - # type: (...) -> "_models.ExpressRouteAuthorization" + resource_group_name: str, + private_cloud_name: str, + authorization_name: str, + authorization: "_models.ExpressRouteAuthorization", + **kwargs: Any + ) -> "_models.ExpressRouteAuthorization": cls = kwargs.pop('cls', None) # type: ClsType["_models.ExpressRouteAuthorization"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'authorizationName': self._serialize.url("authorization_name", authorization_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(authorization, 'ExpressRouteAuthorization') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + authorization_name=authorization_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(authorization, 'ExpressRouteAuthorization') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,17 +385,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - private_cloud_name, # type: str - authorization_name, # type: str - authorization, # type: "_models.ExpressRouteAuthorization" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ExpressRouteAuthorization"] + resource_group_name: str, + private_cloud_name: str, + authorization_name: str, + authorization: "_models.ExpressRouteAuthorization", + **kwargs: Any + ) -> LROPoller["_models.ExpressRouteAuthorization"]: """Create or update an ExpressRoute Circuit Authorization in a private cloud. Create or update an ExpressRoute Circuit Authorization in a private cloud. @@ -272,15 +412,19 @@ def begin_create_or_update( :type authorization: ~azure.mgmt.avs.models.ExpressRouteAuthorization :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ExpressRouteAuthorization or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ExpressRouteAuthorization or the result + of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ExpressRouteAuthorization"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,28 +437,21 @@ def begin_create_or_update( private_cloud_name=private_cloud_name, authorization_name=authorization_name, authorization=authorization, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('ExpressRouteAuthorization', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'authorizationName': self._serialize.url("authorization_name", authorization_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -326,43 +463,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - authorization_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + private_cloud_name: str, + authorization_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'authorizationName': self._serialize.url("authorization_name", authorization_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + authorization_name=authorization_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -375,14 +502,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - private_cloud_name, # type: str - authorization_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + private_cloud_name: str, + authorization_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete an ExpressRoute Circuit Authorization in a private cloud. Delete an ExpressRoute Circuit Authorization in a private cloud. @@ -395,15 +523,17 @@ def begin_delete( :type authorization_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,22 +548,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'authorizationName': self._serialize.url("authorization_name", authorization_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -445,4 +567,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_cloud_links_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_cloud_links_operations.py index 36cb04a58572..0d9feeeed6a9 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_cloud_links_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_cloud_links_operations.py @@ -5,25 +5,183 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + cloud_link_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "cloudLinkName": _SERIALIZER.url("cloud_link_name", cloud_link_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + cloud_link_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "cloudLinkName": _SERIALIZER.url("cloud_link_name", cloud_link_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + cloud_link_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "cloudLinkName": _SERIALIZER.url("cloud_link_name", cloud_link_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class CloudLinksOperations(object): """CloudLinksOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CloudLinkList"] + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> Iterable["_models.CloudLinkList"]: """List cloud link in a private cloud. List cloud link in a private cloud. @@ -72,36 +230,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CloudLinkList', pipeline_response) + deserialized = self._deserialize("CloudLinkList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +274,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cloud_link_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CloudLink" + resource_group_name: str, + private_cloud_name: str, + cloud_link_name: str, + **kwargs: Any + ) -> "_models.CloudLink": """Get an cloud link by name in a private cloud. Get an cloud link by name in a private cloud. @@ -152,28 +308,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'cloudLinkName': self._serialize.url("cloud_link_name", cloud_link_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cloud_link_name=cloud_link_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +333,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cloud_link_name, # type: str - cloud_link, # type: "_models.CloudLink" - **kwargs # type: Any - ): - # type: (...) -> "_models.CloudLink" + resource_group_name: str, + private_cloud_name: str, + cloud_link_name: str, + cloud_link: "_models.CloudLink", + **kwargs: Any + ) -> "_models.CloudLink": cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudLink"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'cloudLinkName': self._serialize.url("cloud_link_name", cloud_link_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(cloud_link, 'CloudLink') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cloud_link_name=cloud_link_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(cloud_link, 'CloudLink') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,17 +384,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cloud_link_name, # type: str - cloud_link, # type: "_models.CloudLink" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CloudLink"] + resource_group_name: str, + private_cloud_name: str, + cloud_link_name: str, + cloud_link: "_models.CloudLink", + **kwargs: Any + ) -> LROPoller["_models.CloudLink"]: """Create or update a cloud link in a private cloud. Create or update a cloud link in a private cloud. @@ -272,15 +411,18 @@ def begin_create_or_update( :type cloud_link: ~azure.mgmt.avs.models.CloudLink :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either CloudLink or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.CloudLink] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudLink"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,28 +435,21 @@ def begin_create_or_update( private_cloud_name=private_cloud_name, cloud_link_name=cloud_link_name, cloud_link=cloud_link, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('CloudLink', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'cloudLinkName': self._serialize.url("cloud_link_name", cloud_link_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -326,43 +461,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cloud_link_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + private_cloud_name: str, + cloud_link_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'cloudLinkName': self._serialize.url("cloud_link_name", cloud_link_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cloud_link_name=cloud_link_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -375,14 +500,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cloud_link_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + private_cloud_name: str, + cloud_link_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a cloud link in a private cloud. Delete a cloud link in a private cloud. @@ -395,15 +521,17 @@ def begin_delete( :type cloud_link_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,22 +546,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'cloudLinkName': self._serialize.url("cloud_link_name", cloud_link_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -445,4 +565,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_clusters_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_clusters_operations.py index c8db0db6d520..9e9c16dbc0fa 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_clusters_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_clusters_operations.py @@ -5,25 +5,229 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ClustersOperations(object): """ClustersOperations operations. @@ -47,13 +251,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ClusterList"] + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> Iterable["_models.ClusterList"]: """List clusters in a private cloud. List clusters in a private cloud. @@ -72,36 +276,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterList', pipeline_response) + deserialized = self._deserialize("ClusterList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +320,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + **kwargs: Any + ) -> "_models.Cluster": """Get a cluster by name in a private cloud. Get a cluster by name in a private cloud. @@ -152,28 +354,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +379,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - cluster, # type: "_models.Cluster" - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + cluster: "_models.Cluster", + **kwargs: Any + ) -> "_models.Cluster": cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(cluster, 'Cluster') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(cluster, 'Cluster') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,17 +430,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - cluster, # type: "_models.Cluster" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Cluster"] + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + cluster: "_models.Cluster", + **kwargs: Any + ) -> LROPoller["_models.Cluster"]: """Create or update a cluster in a private cloud. Create or update a cluster in a private cloud. @@ -272,15 +457,18 @@ def begin_create_or_update( :type cluster: ~azure.mgmt.avs.models.Cluster :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Cluster or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,28 +481,21 @@ def begin_create_or_update( private_cloud_name=private_cloud_name, cluster_name=cluster_name, cluster=cluster, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('Cluster', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -326,49 +507,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - cluster_update, # type: "_models.ClusterUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + cluster_update: "_models.ClusterUpdate", + **kwargs: Any + ) -> "_models.Cluster": cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(cluster_update, 'ClusterUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(cluster_update, 'ClusterUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -386,17 +557,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - cluster_update, # type: "_models.ClusterUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Cluster"] + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + cluster_update: "_models.ClusterUpdate", + **kwargs: Any + ) -> LROPoller["_models.Cluster"]: """Update a cluster in a private cloud. Update a cluster in a private cloud. @@ -411,15 +584,18 @@ def begin_update( :type cluster_update: ~azure.mgmt.avs.models.ClusterUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Cluster or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] lro_delay = kwargs.pop( 'polling_interval', @@ -432,28 +608,21 @@ def begin_update( private_cloud_name=private_cloud_name, cluster_name=cluster_name, cluster_update=cluster_update, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('Cluster', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -465,43 +634,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -514,14 +673,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a cluster in a private cloud. Delete a cluster in a private cloud. @@ -534,15 +694,17 @@ def begin_delete( :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -557,22 +719,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -584,4 +738,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_datastores_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_datastores_operations.py index d06b71646495..57a4d03ae92c 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_datastores_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_datastores_operations.py @@ -5,25 +5,191 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + datastore_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "datastoreName": _SERIALIZER.url("datastore_name", datastore_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + datastore_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "datastoreName": _SERIALIZER.url("datastore_name", datastore_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + datastore_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "datastoreName": _SERIALIZER.url("datastore_name", datastore_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DatastoresOperations(object): """DatastoresOperations operations. @@ -47,14 +213,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DatastoreList"] + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.DatastoreList"]: """List datastores in a private cloud cluster. List datastores in a private cloud cluster. @@ -75,37 +241,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DatastoreList', pipeline_response) + deserialized = self._deserialize("DatastoreList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,20 +287,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - datastore_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Datastore" + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + datastore_name: str, + **kwargs: Any + ) -> "_models.Datastore": """Get a datastore in a private cloud cluster. Get a datastore in a private cloud cluster. @@ -159,29 +324,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'datastoreName': self._serialize.url("datastore_name", datastore_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + datastore_name=datastore_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -195,51 +350,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - datastore_name, # type: str - datastore, # type: "_models.Datastore" - **kwargs # type: Any - ): - # type: (...) -> "_models.Datastore" + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + datastore_name: str, + datastore: "_models.Datastore", + **kwargs: Any + ) -> "_models.Datastore": cls = kwargs.pop('cls', None) # type: ClsType["_models.Datastore"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'datastoreName': self._serialize.url("datastore_name", datastore_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(datastore, 'Datastore') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + datastore_name=datastore_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(datastore, 'Datastore') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -257,18 +403,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - datastore_name, # type: str - datastore, # type: "_models.Datastore" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Datastore"] + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + datastore_name: str, + datastore: "_models.Datastore", + **kwargs: Any + ) -> LROPoller["_models.Datastore"]: """Create or update a datastore in a private cloud cluster. Create or update a datastore in a private cloud cluster. @@ -285,15 +433,18 @@ def begin_create_or_update( :type datastore: ~azure.mgmt.avs.models.Datastore :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Datastore or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Datastore] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Datastore"] lro_delay = kwargs.pop( 'polling_interval', @@ -307,29 +458,21 @@ def begin_create_or_update( cluster_name=cluster_name, datastore_name=datastore_name, datastore=datastore, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('Datastore', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'datastoreName': self._serialize.url("datastore_name", datastore_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -341,45 +484,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - datastore_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + datastore_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'datastoreName': self._serialize.url("datastore_name", datastore_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + datastore_name=datastore_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -392,15 +525,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - datastore_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + datastore_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a datastore in a private cloud cluster. Delete a datastore in a private cloud cluster. @@ -415,15 +549,17 @@ def begin_delete( :type datastore_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -439,23 +575,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'datastoreName': self._serialize.url("datastore_name", datastore_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -467,4 +594,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_global_reach_connections_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_global_reach_connections_operations.py index 5174658a469d..24b40d04699e 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_global_reach_connections_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_global_reach_connections_operations.py @@ -5,25 +5,183 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + global_reach_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "globalReachConnectionName": _SERIALIZER.url("global_reach_connection_name", global_reach_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + global_reach_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "globalReachConnectionName": _SERIALIZER.url("global_reach_connection_name", global_reach_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + global_reach_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "globalReachConnectionName": _SERIALIZER.url("global_reach_connection_name", global_reach_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GlobalReachConnectionsOperations(object): """GlobalReachConnectionsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GlobalReachConnectionList"] + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> Iterable["_models.GlobalReachConnectionList"]: """List global reach connections in a private cloud. List global reach connections in a private cloud. @@ -63,7 +221,8 @@ def list( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GlobalReachConnectionList or the result of cls(response) + :return: An iterator like instance of either GlobalReachConnectionList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.GlobalReachConnectionList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -72,36 +231,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GlobalReachConnectionList', pipeline_response) + deserialized = self._deserialize("GlobalReachConnectionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +275,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - private_cloud_name, # type: str - global_reach_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GlobalReachConnection" + resource_group_name: str, + private_cloud_name: str, + global_reach_connection_name: str, + **kwargs: Any + ) -> "_models.GlobalReachConnection": """Get a global reach connection by name in a private cloud. Get a global reach connection by name in a private cloud. @@ -152,28 +309,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'globalReachConnectionName': self._serialize.url("global_reach_connection_name", global_reach_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + global_reach_connection_name=global_reach_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +334,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - global_reach_connection_name, # type: str - global_reach_connection, # type: "_models.GlobalReachConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.GlobalReachConnection" + resource_group_name: str, + private_cloud_name: str, + global_reach_connection_name: str, + global_reach_connection: "_models.GlobalReachConnection", + **kwargs: Any + ) -> "_models.GlobalReachConnection": cls = kwargs.pop('cls', None) # type: ClsType["_models.GlobalReachConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'globalReachConnectionName': self._serialize.url("global_reach_connection_name", global_reach_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(global_reach_connection, 'GlobalReachConnection') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + global_reach_connection_name=global_reach_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(global_reach_connection, 'GlobalReachConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,17 +385,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - private_cloud_name, # type: str - global_reach_connection_name, # type: str - global_reach_connection, # type: "_models.GlobalReachConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GlobalReachConnection"] + resource_group_name: str, + private_cloud_name: str, + global_reach_connection_name: str, + global_reach_connection: "_models.GlobalReachConnection", + **kwargs: Any + ) -> LROPoller["_models.GlobalReachConnection"]: """Create or update a global reach connection in a private cloud. Create or update a global reach connection in a private cloud. @@ -272,15 +412,19 @@ def begin_create_or_update( :type global_reach_connection: ~azure.mgmt.avs.models.GlobalReachConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GlobalReachConnection or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GlobalReachConnection or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.GlobalReachConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GlobalReachConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,28 +437,21 @@ def begin_create_or_update( private_cloud_name=private_cloud_name, global_reach_connection_name=global_reach_connection_name, global_reach_connection=global_reach_connection, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('GlobalReachConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'globalReachConnectionName': self._serialize.url("global_reach_connection_name", global_reach_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -326,43 +463,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - global_reach_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + private_cloud_name: str, + global_reach_connection_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'globalReachConnectionName': self._serialize.url("global_reach_connection_name", global_reach_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + global_reach_connection_name=global_reach_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -375,14 +502,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - private_cloud_name, # type: str - global_reach_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + private_cloud_name: str, + global_reach_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a global reach connection in a private cloud. Delete a global reach connection in a private cloud. @@ -395,15 +523,17 @@ def begin_delete( :type global_reach_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,22 +548,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'globalReachConnectionName': self._serialize.url("global_reach_connection_name", global_reach_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -445,4 +567,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_hcx_enterprise_sites_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_hcx_enterprise_sites_operations.py index 4d2296c144a8..9a30c1dd314a 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_hcx_enterprise_sites_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_hcx_enterprise_sites_operations.py @@ -5,23 +5,181 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + hcx_enterprise_site_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "hcxEnterpriseSiteName": _SERIALIZER.url("hcx_enterprise_site_name", hcx_enterprise_site_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + hcx_enterprise_site_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "hcxEnterpriseSiteName": _SERIALIZER.url("hcx_enterprise_site_name", hcx_enterprise_site_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + hcx_enterprise_site_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "hcxEnterpriseSiteName": _SERIALIZER.url("hcx_enterprise_site_name", hcx_enterprise_site_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class HcxEnterpriseSitesOperations(object): """HcxEnterpriseSitesOperations operations. @@ -45,13 +203,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.HcxEnterpriseSiteList"] + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> Iterable["_models.HcxEnterpriseSiteList"]: """List HCX Enterprise Sites in a private cloud. List HCX Enterprise Sites in a private cloud. @@ -61,7 +219,8 @@ def list( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either HcxEnterpriseSiteList or the result of cls(response) + :return: An iterator like instance of either HcxEnterpriseSiteList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.HcxEnterpriseSiteList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,36 +229,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('HcxEnterpriseSiteList', pipeline_response) + deserialized = self._deserialize("HcxEnterpriseSiteList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +273,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - private_cloud_name, # type: str - hcx_enterprise_site_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.HcxEnterpriseSite" + resource_group_name: str, + private_cloud_name: str, + hcx_enterprise_site_name: str, + **kwargs: Any + ) -> "_models.HcxEnterpriseSite": """Get an HCX Enterprise Site by name in a private cloud. Get an HCX Enterprise Site by name in a private cloud. @@ -150,28 +307,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'hcxEnterpriseSiteName': self._serialize.url("hcx_enterprise_site_name", hcx_enterprise_site_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + hcx_enterprise_site_name=hcx_enterprise_site_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,17 +332,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - private_cloud_name, # type: str - hcx_enterprise_site_name, # type: str - hcx_enterprise_site, # type: "_models.HcxEnterpriseSite" - **kwargs # type: Any - ): - # type: (...) -> "_models.HcxEnterpriseSite" + resource_group_name: str, + private_cloud_name: str, + hcx_enterprise_site_name: str, + hcx_enterprise_site: "_models.HcxEnterpriseSite", + **kwargs: Any + ) -> "_models.HcxEnterpriseSite": """Create or update an HCX Enterprise Site in a private cloud. Create or update an HCX Enterprise Site in a private cloud. @@ -218,33 +367,23 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'hcxEnterpriseSiteName': self._serialize.url("hcx_enterprise_site_name", hcx_enterprise_site_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(hcx_enterprise_site, 'HcxEnterpriseSite') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + hcx_enterprise_site_name=hcx_enterprise_site_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(hcx_enterprise_site, 'HcxEnterpriseSite') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -262,16 +401,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - private_cloud_name, # type: str - hcx_enterprise_site_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + private_cloud_name: str, + hcx_enterprise_site_name: str, + **kwargs: Any + ) -> None: """Delete an HCX Enterprise Site in a private cloud. Delete an HCX Enterprise Site in a private cloud. @@ -292,28 +433,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'hcxEnterpriseSiteName': self._serialize.url("hcx_enterprise_site_name", hcx_enterprise_site_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + hcx_enterprise_site_name=hcx_enterprise_site_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -325,3 +456,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_locations_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_locations_operations.py index 2228c4fa769c..848f90ac87d9 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_locations_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_locations_operations.py @@ -5,22 +5,90 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_check_trial_availability_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_quota_availability_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class LocationsOperations(object): """LocationsOperations operations. @@ -44,12 +112,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_trial_availability( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Trial" + location: str, + **kwargs: Any + ) -> "_models.Trial": """Return trial status for subscription by region. :param location: Azure region. @@ -64,26 +132,16 @@ def check_trial_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.check_trial_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_check_trial_availability_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.check_trial_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -97,14 +155,16 @@ def check_trial_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_trial_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability'} # type: ignore + + @distributed_trace def check_quota_availability( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Quota" + location: str, + **kwargs: Any + ) -> "_models.Quota": """Return quota for subscription by region. :param location: Azure region. @@ -119,26 +179,16 @@ def check_quota_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.check_quota_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_check_quota_availability_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.check_quota_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -152,4 +202,6 @@ def check_quota_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_quota_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_operations.py index 3eac2fb43b68..90b62becfc70 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.AVS/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationList"] + **kwargs: Any + ) -> Iterable["_models.OperationList"]: """Lists all of the available operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,30 +89,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationList', pipeline_response) + deserialized = self._deserialize("OperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +127,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_placement_policies_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_placement_policies_operations.py index 29456e8a91cc..e5f2120af122 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_placement_policies_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_placement_policies_operations.py @@ -5,25 +5,239 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + placement_policy_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "placementPolicyName": _SERIALIZER.url("placement_policy_name", placement_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + placement_policy_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "placementPolicyName": _SERIALIZER.url("placement_policy_name", placement_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + placement_policy_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "placementPolicyName": _SERIALIZER.url("placement_policy_name", placement_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + placement_policy_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "placementPolicyName": _SERIALIZER.url("placement_policy_name", placement_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PlacementPoliciesOperations(object): """PlacementPoliciesOperations operations. @@ -47,14 +261,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PlacementPoliciesList"] + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.PlacementPoliciesList"]: """List placement policies in a private cloud cluster. List placement policies in a private cloud cluster. @@ -66,7 +280,8 @@ def list( :param cluster_name: Name of the cluster in the private cloud. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PlacementPoliciesList or the result of cls(response) + :return: An iterator like instance of either PlacementPoliciesList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.PlacementPoliciesList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -75,37 +290,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PlacementPoliciesList', pipeline_response) + deserialized = self._deserialize("PlacementPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,20 +336,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - placement_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PlacementPolicy" + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + placement_policy_name: str, + **kwargs: Any + ) -> "_models.PlacementPolicy": """Get a placement policy by name in a private cloud cluster. Get a placement policy by name in a private cloud cluster. @@ -160,29 +374,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'placementPolicyName': self._serialize.url("placement_policy_name", placement_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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + placement_policy_name=placement_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -196,51 +400,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - placement_policy_name, # type: str - placement_policy, # type: "_models.PlacementPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.PlacementPolicy" + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + placement_policy_name: str, + placement_policy: "_models.PlacementPolicy", + **kwargs: Any + ) -> "_models.PlacementPolicy": cls = kwargs.pop('cls', None) # type: ClsType["_models.PlacementPolicy"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'placementPolicyName': self._serialize.url("placement_policy_name", placement_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(placement_policy, 'PlacementPolicy') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + placement_policy_name=placement_policy_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(placement_policy, 'PlacementPolicy') - 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 @@ -258,18 +453,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - placement_policy_name, # type: str - placement_policy, # type: "_models.PlacementPolicy" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PlacementPolicy"] + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + placement_policy_name: str, + placement_policy: "_models.PlacementPolicy", + **kwargs: Any + ) -> LROPoller["_models.PlacementPolicy"]: """Create or update a placement policy in a private cloud cluster. Create or update a placement policy in a private cloud cluster. @@ -287,15 +484,19 @@ def begin_create_or_update( :type placement_policy: ~azure.mgmt.avs.models.PlacementPolicy :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. + :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 PlacementPolicy or the result of cls(response) + :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 PlacementPolicy or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PlacementPolicy] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PlacementPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -309,29 +510,21 @@ def begin_create_or_update( cluster_name=cluster_name, placement_policy_name=placement_policy_name, placement_policy=placement_policy, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('PlacementPolicy', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'placementPolicyName': self._serialize.url("placement_policy_name", placement_policy_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -343,51 +536,41 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - placement_policy_name, # type: str - placement_policy_update, # type: "_models.PlacementPolicyUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.PlacementPolicy" + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + placement_policy_name: str, + placement_policy_update: "_models.PlacementPolicyUpdate", + **kwargs: Any + ) -> "_models.PlacementPolicy": cls = kwargs.pop('cls', None) # type: ClsType["_models.PlacementPolicy"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'placementPolicyName': self._serialize.url("placement_policy_name", placement_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(placement_policy_update, 'PlacementPolicyUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + placement_policy_name=placement_policy_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(placement_policy_update, 'PlacementPolicyUpdate') - 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 @@ -405,18 +588,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - placement_policy_name, # type: str - placement_policy_update, # type: "_models.PlacementPolicyUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PlacementPolicy"] + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + placement_policy_name: str, + placement_policy_update: "_models.PlacementPolicyUpdate", + **kwargs: Any + ) -> LROPoller["_models.PlacementPolicy"]: """Update a placement policy in a private cloud cluster. Update a placement policy in a private cloud cluster. @@ -434,15 +619,19 @@ def begin_update( :type placement_policy_update: ~azure.mgmt.avs.models.PlacementPolicyUpdate :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. + :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 PlacementPolicy or the result of cls(response) + :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 PlacementPolicy or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PlacementPolicy] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PlacementPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -456,29 +645,21 @@ def begin_update( cluster_name=cluster_name, placement_policy_name=placement_policy_name, placement_policy_update=placement_policy_update, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('PlacementPolicy', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'placementPolicyName': self._serialize.url("placement_policy_name", placement_policy_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -490,45 +671,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - placement_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + placement_policy_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'placementPolicyName': self._serialize.url("placement_policy_name", placement_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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + placement_policy_name=placement_policy_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -541,15 +712,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - placement_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + placement_policy_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a placement policy in a private cloud cluster. Delete a placement policy in a private cloud cluster. @@ -565,15 +737,17 @@ def begin_delete( :type placement_policy_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -589,23 +763,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'placementPolicyName': self._serialize.url("placement_policy_name", placement_policy_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -617,4 +782,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_private_clouds_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_private_clouds_operations.py index 3085e8a1d2a7..16762331ffab 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_private_clouds_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_private_clouds_operations.py @@ -5,25 +5,355 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_in_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_rotate_vcenter_password_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_rotate_nsxt_password_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_admin_credentials_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/listAdminCredentials') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateCloudsOperations(object): """PrivateCloudsOperations operations. @@ -47,12 +377,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateCloudList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateCloudList"]: """List private clouds in a resource group. List private clouds in a resource group. @@ -69,35 +399,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateCloudList', pipeline_response) + deserialized = self._deserialize("PrivateCloudList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,16 +441,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds'} # type: ignore + @distributed_trace def list_in_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateCloudList"] + **kwargs: Any + ) -> Iterable["_models.PrivateCloudList"]: """List private clouds in a subscription. List private clouds in a subscription. @@ -139,34 +466,29 @@ def list_in_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_in_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_in_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_in_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_in_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateCloudList', pipeline_response) + deserialized = self._deserialize("PrivateCloudList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -184,18 +506,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_in_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateCloud" + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> "_models.PrivateCloud": """Get a private cloud. Get a private cloud. @@ -214,27 +537,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -248,47 +561,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - private_cloud, # type: "_models.PrivateCloud" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateCloud" + resource_group_name: str, + private_cloud_name: str, + private_cloud: "_models.PrivateCloud", + **kwargs: Any + ) -> "_models.PrivateCloud": cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateCloud"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(private_cloud, 'PrivateCloud') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_cloud, 'PrivateCloud') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -306,16 +610,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - private_cloud_name, # type: str - private_cloud, # type: "_models.PrivateCloud" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateCloud"] + resource_group_name: str, + private_cloud_name: str, + private_cloud: "_models.PrivateCloud", + **kwargs: Any + ) -> LROPoller["_models.PrivateCloud"]: """Create or update a private cloud. Create or update a private cloud. @@ -328,15 +634,19 @@ def begin_create_or_update( :type private_cloud: ~azure.mgmt.avs.models.PrivateCloud :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateCloud or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateCloud or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateCloud"] lro_delay = kwargs.pop( 'polling_interval', @@ -348,27 +658,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, private_cloud=private_cloud, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('PrivateCloud', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -380,47 +684,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - private_cloud_update, # type: "_models.PrivateCloudUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateCloud" + resource_group_name: str, + private_cloud_name: str, + private_cloud_update: "_models.PrivateCloudUpdate", + **kwargs: Any + ) -> "_models.PrivateCloud": cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateCloud"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(private_cloud_update, 'PrivateCloudUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_cloud_update, 'PrivateCloudUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -438,16 +732,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - private_cloud_name, # type: str - private_cloud_update, # type: "_models.PrivateCloudUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateCloud"] + resource_group_name: str, + private_cloud_name: str, + private_cloud_update: "_models.PrivateCloudUpdate", + **kwargs: Any + ) -> LROPoller["_models.PrivateCloud"]: """Update a private cloud. Update a private cloud. @@ -460,15 +756,19 @@ def begin_update( :type private_cloud_update: ~azure.mgmt.avs.models.PrivateCloudUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateCloud or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateCloud or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateCloud"] lro_delay = kwargs.pop( 'polling_interval', @@ -480,27 +780,21 @@ def begin_update( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, private_cloud_update=private_cloud_update, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('PrivateCloud', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -512,41 +806,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -559,13 +843,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a private cloud. Delete a private cloud. @@ -576,15 +861,17 @@ def begin_delete( :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -598,21 +885,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -624,41 +904,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}'} # type: ignore def _rotate_vcenter_password_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._rotate_vcenter_password_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_rotate_vcenter_password_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self._rotate_vcenter_password_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -671,13 +941,14 @@ def _rotate_vcenter_password_initial( _rotate_vcenter_password_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword'} # type: ignore + + @distributed_trace def begin_rotate_vcenter_password( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Rotate the vCenter password. Rotate the vCenter password. @@ -688,15 +959,17 @@ def begin_rotate_vcenter_password( :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -710,21 +983,14 @@ def begin_rotate_vcenter_password( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -736,41 +1002,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_rotate_vcenter_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword'} # type: ignore def _rotate_nsxt_password_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._rotate_nsxt_password_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_rotate_nsxt_password_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self._rotate_nsxt_password_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -783,13 +1039,14 @@ def _rotate_nsxt_password_initial( _rotate_nsxt_password_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword'} # type: ignore + + @distributed_trace def begin_rotate_nsxt_password( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Rotate the NSX-T Manager password. Rotate the NSX-T Manager password. @@ -800,15 +1057,17 @@ def begin_rotate_nsxt_password( :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -822,21 +1081,14 @@ def begin_rotate_nsxt_password( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -848,15 +1100,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_rotate_nsxt_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword'} # type: ignore + @distributed_trace def list_admin_credentials( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AdminCredentials" + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> "_models.AdminCredentials": """List the admin credentials for the private cloud. List the admin credentials for the private cloud. @@ -875,27 +1128,17 @@ def list_admin_credentials( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.list_admin_credentials.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_admin_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list_admin_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -909,4 +1152,6 @@ def list_admin_credentials( return cls(pipeline_response, deserialized, {}) return deserialized + list_admin_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/listAdminCredentials'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_cmdlets_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_cmdlets_operations.py index 554fa942fbbd..1f8e376f2f9e 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_cmdlets_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_cmdlets_operations.py @@ -5,23 +5,101 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_list_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + script_package_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "scriptPackageName": _SERIALIZER.url("script_package_name", script_package_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + script_package_name: str, + script_cmdlet_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets/{scriptCmdletName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "scriptPackageName": _SERIALIZER.url("script_package_name", script_package_name, 'str'), + "scriptCmdletName": _SERIALIZER.url("script_cmdlet_name", script_cmdlet_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ScriptCmdletsOperations(object): """ScriptCmdletsOperations operations. @@ -45,14 +123,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - private_cloud_name, # type: str - script_package_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ScriptCmdletsList"] + resource_group_name: str, + private_cloud_name: str, + script_package_name: str, + **kwargs: Any + ) -> Iterable["_models.ScriptCmdletsList"]: """List script cmdlet resources available for a private cloud to create a script execution resource on a private cloud. @@ -72,37 +150,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'scriptPackageName': self._serialize.url("script_package_name", script_package_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + script_package_name=script_package_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + script_package_name=script_package_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ScriptCmdletsList', pipeline_response) + deserialized = self._deserialize("ScriptCmdletsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -120,20 +196,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - private_cloud_name, # type: str - script_package_name, # type: str - script_cmdlet_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ScriptCmdlet" + resource_group_name: str, + private_cloud_name: str, + script_package_name: str, + script_cmdlet_name: str, + **kwargs: Any + ) -> "_models.ScriptCmdlet": """Return information about a script cmdlet resource in a specific package on a private cloud. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -155,29 +232,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'scriptPackageName': self._serialize.url("script_package_name", script_package_name, 'str'), - 'scriptCmdletName': self._serialize.url("script_cmdlet_name", script_cmdlet_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + script_package_name=script_package_name, + script_cmdlet_name=script_cmdlet_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -191,4 +258,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets/{scriptCmdletName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_executions_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_executions_operations.py index 25318db5a893..037e3e85f905 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_executions_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_executions_operations.py @@ -5,25 +5,229 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + script_execution_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "scriptExecutionName": _SERIALIZER.url("script_execution_name", script_execution_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + script_execution_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "scriptExecutionName": _SERIALIZER.url("script_execution_name", script_execution_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + script_execution_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "scriptExecutionName": _SERIALIZER.url("script_execution_name", script_execution_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_execution_logs_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + script_execution_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}/getExecutionLogs') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "scriptExecutionName": _SERIALIZER.url("script_execution_name", script_execution_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class ScriptExecutionsOperations(object): """ScriptExecutionsOperations operations. @@ -47,13 +251,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ScriptExecutionsList"] + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> Iterable["_models.ScriptExecutionsList"]: """List script executions in a private cloud. List script executions in a private cloud. @@ -63,7 +267,8 @@ def list( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ScriptExecutionsList or the result of cls(response) + :return: An iterator like instance of either ScriptExecutionsList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.ScriptExecutionsList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -72,36 +277,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ScriptExecutionsList', pipeline_response) + deserialized = self._deserialize("ScriptExecutionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +321,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - private_cloud_name, # type: str - script_execution_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ScriptExecution" + resource_group_name: str, + private_cloud_name: str, + script_execution_name: str, + **kwargs: Any + ) -> "_models.ScriptExecution": """Get an script execution by name in a private cloud. Get an script execution by name in a private cloud. @@ -152,28 +355,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + script_execution_name=script_execution_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +380,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - script_execution_name, # type: str - script_execution, # type: "_models.ScriptExecution" - **kwargs # type: Any - ): - # type: (...) -> "_models.ScriptExecution" + resource_group_name: str, + private_cloud_name: str, + script_execution_name: str, + script_execution: "_models.ScriptExecution", + **kwargs: Any + ) -> "_models.ScriptExecution": cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptExecution"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(script_execution, 'ScriptExecution') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + script_execution_name=script_execution_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(script_execution, 'ScriptExecution') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,17 +431,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - private_cloud_name, # type: str - script_execution_name, # type: str - script_execution, # type: "_models.ScriptExecution" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ScriptExecution"] + resource_group_name: str, + private_cloud_name: str, + script_execution_name: str, + script_execution: "_models.ScriptExecution", + **kwargs: Any + ) -> LROPoller["_models.ScriptExecution"]: """Create or update a script execution in a private cloud. Create or update a script execution in a private cloud. @@ -272,15 +458,19 @@ def begin_create_or_update( :type script_execution: ~azure.mgmt.avs.models.ScriptExecution :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ScriptExecution or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ScriptExecution or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ScriptExecution] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptExecution"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,28 +483,21 @@ def begin_create_or_update( private_cloud_name=private_cloud_name, script_execution_name=script_execution_name, script_execution=script_execution, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('ScriptExecution', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -326,43 +509,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - script_execution_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + private_cloud_name: str, + script_execution_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + script_execution_name=script_execution_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -375,14 +548,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - private_cloud_name, # type: str - script_execution_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + private_cloud_name: str, + script_execution_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Cancel a ScriptExecution in a private cloud. Cancel a ScriptExecution in a private cloud. @@ -395,15 +569,17 @@ def begin_delete( :type script_execution_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,22 +594,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -445,17 +613,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}'} # type: ignore + @distributed_trace def get_execution_logs( self, - resource_group_name, # type: str - private_cloud_name, # type: str - script_execution_name, # type: str - script_output_stream_type=None, # type: Optional[List[Union[str, "_models.ScriptOutputStreamType"]]] - **kwargs # type: Any - ): - # type: (...) -> "_models.ScriptExecution" + resource_group_name: str, + private_cloud_name: str, + script_execution_name: str, + script_output_stream_type: Optional[List[Union[str, "_models.ScriptOutputStreamType"]]] = None, + **kwargs: Any + ) -> "_models.ScriptExecution": """Return the logs for a script execution resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -477,36 +646,26 @@ def get_execution_logs( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.get_execution_logs.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'scriptExecutionName': self._serialize.url("script_execution_name", script_execution_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if script_output_stream_type is not None: - body_content = self._serialize.body(script_output_stream_type, '[str]') + _json = self._serialize.body(script_output_stream_type, '[str]') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_get_execution_logs_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + script_execution_name=script_execution_name, + content_type=content_type, + json=_json, + template_url=self.get_execution_logs.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -520,4 +679,6 @@ def get_execution_logs( return cls(pipeline_response, deserialized, {}) return deserialized + get_execution_logs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}/getExecutionLogs'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_packages_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_packages_operations.py index 3b6f1cc8d54b..0705d85208a0 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_packages_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_packages_operations.py @@ -5,23 +5,97 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + script_package_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "scriptPackageName": _SERIALIZER.url("script_package_name", script_package_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ScriptPackagesOperations(object): """ScriptPackagesOperations operations. @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ScriptPackagesList"] + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> Iterable["_models.ScriptPackagesList"]: """List script packages available to run on the private cloud. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -68,36 +142,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ScriptPackagesList', pipeline_response) + deserialized = self._deserialize("ScriptPackagesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,19 +186,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - private_cloud_name, # type: str - script_package_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ScriptPackage" + resource_group_name: str, + private_cloud_name: str, + script_package_name: str, + **kwargs: Any + ) -> "_models.ScriptPackage": """Get a script package available to run on a private cloud. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -146,28 +218,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'scriptPackageName': self._serialize.url("script_package_name", script_package_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + script_package_name=script_package_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,4 +243,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_virtual_machines_operations.py index 3ce349e773f2..a3267d0eeb0a 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_virtual_machines_operations.py @@ -5,25 +5,152 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + virtual_machine_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "virtualMachineId": _SERIALIZER.url("virtual_machine_id", virtual_machine_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restrict_movement_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + virtual_machine_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "virtualMachineId": _SERIALIZER.url("virtual_machine_id", virtual_machine_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VirtualMachinesOperations(object): """VirtualMachinesOperations operations. @@ -47,14 +174,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualMachinesList"] + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualMachinesList"]: """List of virtual machines in a private cloud cluster. List of virtual machines in a private cloud cluster. @@ -75,37 +202,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualMachinesList', pipeline_response) + deserialized = self._deserialize("VirtualMachinesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,20 +248,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - virtual_machine_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachine" + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + virtual_machine_id: str, + **kwargs: Any + ) -> "_models.VirtualMachine": """Get a virtual machine by id in a private cloud cluster. Get a virtual machine by id in a private cloud cluster. @@ -159,29 +285,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'virtualMachineId': self._serialize.url("virtual_machine_id", virtual_machine_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + virtual_machine_id=virtual_machine_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -195,51 +311,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}'} # type: ignore + def _restrict_movement_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - virtual_machine_id, # type: str - restrict_movement, # type: "_models.VirtualMachineRestrictMovement" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + virtual_machine_id: str, + restrict_movement: "_models.VirtualMachineRestrictMovement", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._restrict_movement_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'virtualMachineId': self._serialize.url("virtual_machine_id", virtual_machine_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(restrict_movement, 'VirtualMachineRestrictMovement') + + request = build_restrict_movement_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + cluster_name=cluster_name, + virtual_machine_id=virtual_machine_id, + content_type=content_type, + json=_json, + template_url=self._restrict_movement_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(restrict_movement, 'VirtualMachineRestrictMovement') - 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 @@ -252,16 +359,17 @@ def _restrict_movement_initial( _restrict_movement_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement'} # type: ignore + + @distributed_trace def begin_restrict_movement( self, - resource_group_name, # type: str - private_cloud_name, # type: str - cluster_name, # type: str - virtual_machine_id, # type: str - restrict_movement, # type: "_models.VirtualMachineRestrictMovement" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + private_cloud_name: str, + cluster_name: str, + virtual_machine_id: str, + restrict_movement: "_models.VirtualMachineRestrictMovement", + **kwargs: Any + ) -> LROPoller[None]: """Enable or disable DRS-driven VM movement restriction. Enable or disable DRS-driven VM movement restriction. @@ -279,15 +387,18 @@ def begin_restrict_movement( :type restrict_movement: ~azure.mgmt.avs.models.VirtualMachineRestrictMovement :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -301,26 +412,18 @@ def begin_restrict_movement( cluster_name=cluster_name, virtual_machine_id=virtual_machine_id, restrict_movement=restrict_movement, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'virtualMachineId': self._serialize.url("virtual_machine_id", virtual_machine_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -332,4 +435,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restrict_movement.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement'} # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_workload_networks_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_workload_networks_operations.py index 7e21bcbc2c7f..251bcca0ca5b 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_workload_networks_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_workload_networks_operations.py @@ -5,25 +5,1533 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer 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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_segments_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_segment_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + segment_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "segmentId": _SERIALIZER.url("segment_id", segment_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_segments_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + segment_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "segmentId": _SERIALIZER.url("segment_id", segment_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_segments_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + segment_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "segmentId": _SERIALIZER.url("segment_id", segment_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_segment_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + segment_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "segmentId": _SERIALIZER.url("segment_id", segment_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_dhcp_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_dhcp_request( + subscription_id: str, + resource_group_name: str, + dhcp_id: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "dhcpId": _SERIALIZER.url("dhcp_id", dhcp_id, 'str'), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_dhcp_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + dhcp_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "dhcpId": _SERIALIZER.url("dhcp_id", dhcp_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_dhcp_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + dhcp_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "dhcpId": _SERIALIZER.url("dhcp_id", dhcp_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_dhcp_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + dhcp_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "dhcpId": _SERIALIZER.url("dhcp_id", dhcp_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_gateways_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_gateway_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + gateway_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_port_mirroring_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_port_mirroring_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + port_mirroring_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "portMirroringId": _SERIALIZER.url("port_mirroring_id", port_mirroring_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_port_mirroring_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + port_mirroring_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "portMirroringId": _SERIALIZER.url("port_mirroring_id", port_mirroring_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_port_mirroring_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + port_mirroring_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "portMirroringId": _SERIALIZER.url("port_mirroring_id", port_mirroring_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_port_mirroring_request_initial( + subscription_id: str, + resource_group_name: str, + port_mirroring_id: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "portMirroringId": _SERIALIZER.url("port_mirroring_id", port_mirroring_id, 'str'), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_vm_groups_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_vm_group_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "vmGroupId": _SERIALIZER.url("vm_group_id", vm_group_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_vm_group_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "vmGroupId": _SERIALIZER.url("vm_group_id", vm_group_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_vm_group_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "vmGroupId": _SERIALIZER.url("vm_group_id", vm_group_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_vm_group_request_initial( + subscription_id: str, + resource_group_name: str, + vm_group_id: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "vmGroupId": _SERIALIZER.url("vm_group_id", vm_group_id, 'str'), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_virtual_machines_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_virtual_machine_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + virtual_machine_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "virtualMachineId": _SERIALIZER.url("virtual_machine_id", virtual_machine_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_dns_services_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_dns_service_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + dns_service_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "dnsServiceId": _SERIALIZER.url("dns_service_id", dns_service_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_dns_service_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + dns_service_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "dnsServiceId": _SERIALIZER.url("dns_service_id", dns_service_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_dns_service_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + dns_service_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "dnsServiceId": _SERIALIZER.url("dns_service_id", dns_service_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_dns_service_request_initial( + subscription_id: str, + resource_group_name: str, + dns_service_id: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "dnsServiceId": _SERIALIZER.url("dns_service_id", dns_service_id, 'str'), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_dns_zones_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_dns_zone_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + dns_zone_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "dnsZoneId": _SERIALIZER.url("dns_zone_id", dns_zone_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_dns_zone_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + dns_zone_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "dnsZoneId": _SERIALIZER.url("dns_zone_id", dns_zone_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_dns_zone_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + dns_zone_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "dnsZoneId": _SERIALIZER.url("dns_zone_id", dns_zone_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_dns_zone_request_initial( + subscription_id: str, + resource_group_name: str, + dns_zone_id: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "dnsZoneId": _SERIALIZER.url("dns_zone_id", dns_zone_id, 'str'), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_public_i_ps_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_public_ip_request( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + public_ip_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "publicIPId": _SERIALIZER.url("public_ip_id", public_ip_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_public_ip_request_initial( + subscription_id: str, + resource_group_name: str, + private_cloud_name: str, + public_ip_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + "publicIPId": _SERIALIZER.url("public_ip_id", public_ip_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_public_ip_request_initial( + subscription_id: str, + resource_group_name: str, + public_ip_id: str, + private_cloud_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publicIPId": _SERIALIZER.url("public_ip_id", public_ip_id, 'str'), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WorkloadNetworksOperations(object): """WorkloadNetworksOperations operations. @@ -47,13 +1555,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_segments( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WorkloadNetworkSegmentsList"] + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> Iterable["_models.WorkloadNetworkSegmentsList"]: """List of segments in a private cloud workload network. List of segments in a private cloud workload network. @@ -63,7 +1571,8 @@ def list_segments( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkSegmentsList or the result of cls(response) + :return: An iterator like instance of either WorkloadNetworkSegmentsList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkSegmentsList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -72,36 +1581,33 @@ def list_segments( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_segments.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_segments_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list_segments.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_segments_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadNetworkSegmentsList', pipeline_response) + deserialized = self._deserialize("WorkloadNetworkSegmentsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +1625,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_segments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments'} # type: ignore + @distributed_trace def get_segment( self, - resource_group_name, # type: str - private_cloud_name, # type: str - segment_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkloadNetworkSegment" + resource_group_name: str, + private_cloud_name: str, + segment_id: str, + **kwargs: Any + ) -> "_models.WorkloadNetworkSegment": """Get a segment by id in a private cloud workload network. Get a segment by id in a private cloud workload network. @@ -152,28 +1659,18 @@ def get_segment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_segment.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'segmentId': self._serialize.url("segment_id", segment_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_segment_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + segment_id=segment_id, + template_url=self.get_segment.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +1684,40 @@ def get_segment( return cls(pipeline_response, deserialized, {}) return deserialized + get_segment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + def _create_segments_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - segment_id, # type: str - workload_network_segment, # type: "_models.WorkloadNetworkSegment" - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkloadNetworkSegment" + resource_group_name: str, + private_cloud_name: str, + segment_id: str, + workload_network_segment: "_models.WorkloadNetworkSegment", + **kwargs: Any + ) -> "_models.WorkloadNetworkSegment": cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkSegment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_segments_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'segmentId': self._serialize.url("segment_id", segment_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(workload_network_segment, 'WorkloadNetworkSegment') + + request = build_create_segments_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + segment_id=segment_id, + content_type=content_type, + json=_json, + template_url=self._create_segments_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_segment, 'WorkloadNetworkSegment') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,17 +1735,19 @@ def _create_segments_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_segments_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + + @distributed_trace def begin_create_segments( self, - resource_group_name, # type: str - private_cloud_name, # type: str - segment_id, # type: str - workload_network_segment, # type: "_models.WorkloadNetworkSegment" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WorkloadNetworkSegment"] + resource_group_name: str, + private_cloud_name: str, + segment_id: str, + workload_network_segment: "_models.WorkloadNetworkSegment", + **kwargs: Any + ) -> LROPoller["_models.WorkloadNetworkSegment"]: """Create a segment by id in a private cloud workload network. Create a segment by id in a private cloud workload network. @@ -272,15 +1762,19 @@ def begin_create_segments( :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkSegment"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,28 +1787,21 @@ def begin_create_segments( private_cloud_name=private_cloud_name, segment_id=segment_id, workload_network_segment=workload_network_segment, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkSegment', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'segmentId': self._serialize.url("segment_id", segment_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -326,49 +1813,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_segments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore def _update_segments_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - segment_id, # type: str - workload_network_segment, # type: "_models.WorkloadNetworkSegment" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.WorkloadNetworkSegment"] + resource_group_name: str, + private_cloud_name: str, + segment_id: str, + workload_network_segment: "_models.WorkloadNetworkSegment", + **kwargs: Any + ) -> Optional["_models.WorkloadNetworkSegment"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WorkloadNetworkSegment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_segments_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'segmentId': self._serialize.url("segment_id", segment_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(workload_network_segment, 'WorkloadNetworkSegment') + + request = build_update_segments_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + segment_id=segment_id, + content_type=content_type, + json=_json, + template_url=self._update_segments_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_segment, 'WorkloadNetworkSegment') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -384,17 +1861,19 @@ def _update_segments_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_segments_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + + @distributed_trace def begin_update_segments( self, - resource_group_name, # type: str - private_cloud_name, # type: str - segment_id, # type: str - workload_network_segment, # type: "_models.WorkloadNetworkSegment" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WorkloadNetworkSegment"] + resource_group_name: str, + private_cloud_name: str, + segment_id: str, + workload_network_segment: "_models.WorkloadNetworkSegment", + **kwargs: Any + ) -> LROPoller["_models.WorkloadNetworkSegment"]: """Create or update a segment by id in a private cloud workload network. Create or update a segment by id in a private cloud workload network. @@ -409,15 +1888,19 @@ def begin_update_segments( :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkSegment"] lro_delay = kwargs.pop( 'polling_interval', @@ -430,28 +1913,21 @@ def begin_update_segments( private_cloud_name=private_cloud_name, segment_id=segment_id, workload_network_segment=workload_network_segment, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkSegment', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'segmentId': self._serialize.url("segment_id", segment_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -463,43 +1939,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_segments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore def _delete_segment_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - segment_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + private_cloud_name: str, + segment_id: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_segment_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'segmentId': self._serialize.url("segment_id", segment_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_segment_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + segment_id=segment_id, + template_url=self._delete_segment_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -512,14 +1978,15 @@ def _delete_segment_initial( _delete_segment_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + + @distributed_trace def begin_delete_segment( self, - resource_group_name, # type: str - private_cloud_name, # type: str - segment_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + private_cloud_name: str, + segment_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a segment by id in a private cloud workload network. Delete a segment by id in a private cloud workload network. @@ -532,15 +1999,17 @@ def begin_delete_segment( :type segment_id: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -555,22 +2024,14 @@ def begin_delete_segment( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'segmentId': self._serialize.url("segment_id", segment_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -582,15 +2043,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_segment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}'} # type: ignore + @distributed_trace def list_dhcp( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WorkloadNetworkDhcpList"] + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> Iterable["_models.WorkloadNetworkDhcpList"]: """List dhcp in a private cloud workload network. List dhcp in a private cloud workload network. @@ -600,7 +2062,8 @@ def list_dhcp( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkDhcpList or the result of cls(response) + :return: An iterator like instance of either WorkloadNetworkDhcpList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDhcpList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -609,36 +2072,33 @@ def list_dhcp( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_dhcp.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_dhcp_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list_dhcp.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_dhcp_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadNetworkDhcpList', pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDhcpList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -656,19 +2116,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_dhcp.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations'} # type: ignore + @distributed_trace def get_dhcp( self, - resource_group_name, # type: str - dhcp_id, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkloadNetworkDhcp" + resource_group_name: str, + dhcp_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> "_models.WorkloadNetworkDhcp": """Get dhcp by id in a private cloud workload network. Get dhcp by id in a private cloud workload network. @@ -689,28 +2150,18 @@ def get_dhcp( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_dhcp.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'dhcpId': self._serialize.url("dhcp_id", dhcp_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_dhcp_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + dhcp_id=dhcp_id, + private_cloud_name=private_cloud_name, + template_url=self.get_dhcp.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -724,49 +2175,40 @@ def get_dhcp( return cls(pipeline_response, deserialized, {}) return deserialized + get_dhcp.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + def _create_dhcp_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - dhcp_id, # type: str - workload_network_dhcp, # type: "_models.WorkloadNetworkDhcp" - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkloadNetworkDhcp" + resource_group_name: str, + private_cloud_name: str, + dhcp_id: str, + workload_network_dhcp: "_models.WorkloadNetworkDhcp", + **kwargs: Any + ) -> "_models.WorkloadNetworkDhcp": cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDhcp"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_dhcp_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dhcpId': self._serialize.url("dhcp_id", dhcp_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(workload_network_dhcp, 'WorkloadNetworkDhcp') - # 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') + request = build_create_dhcp_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dhcp_id=dhcp_id, + content_type=content_type, + json=_json, + template_url=self._create_dhcp_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_dhcp, 'WorkloadNetworkDhcp') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -784,17 +2226,19 @@ def _create_dhcp_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_dhcp_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + + @distributed_trace def begin_create_dhcp( self, - resource_group_name, # type: str - private_cloud_name, # type: str - dhcp_id, # type: str - workload_network_dhcp, # type: "_models.WorkloadNetworkDhcp" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WorkloadNetworkDhcp"] + resource_group_name: str, + private_cloud_name: str, + dhcp_id: str, + workload_network_dhcp: "_models.WorkloadNetworkDhcp", + **kwargs: Any + ) -> LROPoller["_models.WorkloadNetworkDhcp"]: """Create dhcp by id in a private cloud workload network. Create dhcp by id in a private cloud workload network. @@ -809,15 +2253,19 @@ def begin_create_dhcp( :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDhcp"] lro_delay = kwargs.pop( 'polling_interval', @@ -830,28 +2278,21 @@ def begin_create_dhcp( private_cloud_name=private_cloud_name, dhcp_id=dhcp_id, workload_network_dhcp=workload_network_dhcp, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkDhcp', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dhcpId': self._serialize.url("dhcp_id", dhcp_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -863,49 +2304,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_dhcp.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore def _update_dhcp_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - dhcp_id, # type: str - workload_network_dhcp, # type: "_models.WorkloadNetworkDhcp" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.WorkloadNetworkDhcp"] + resource_group_name: str, + private_cloud_name: str, + dhcp_id: str, + workload_network_dhcp: "_models.WorkloadNetworkDhcp", + **kwargs: Any + ) -> Optional["_models.WorkloadNetworkDhcp"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WorkloadNetworkDhcp"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_dhcp_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dhcpId': self._serialize.url("dhcp_id", dhcp_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(workload_network_dhcp, 'WorkloadNetworkDhcp') + + request = build_update_dhcp_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dhcp_id=dhcp_id, + content_type=content_type, + json=_json, + template_url=self._update_dhcp_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_dhcp, 'WorkloadNetworkDhcp') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -921,17 +2352,19 @@ def _update_dhcp_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_dhcp_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + + @distributed_trace def begin_update_dhcp( self, - resource_group_name, # type: str - private_cloud_name, # type: str - dhcp_id, # type: str - workload_network_dhcp, # type: "_models.WorkloadNetworkDhcp" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WorkloadNetworkDhcp"] + resource_group_name: str, + private_cloud_name: str, + dhcp_id: str, + workload_network_dhcp: "_models.WorkloadNetworkDhcp", + **kwargs: Any + ) -> LROPoller["_models.WorkloadNetworkDhcp"]: """Create or update dhcp by id in a private cloud workload network. Create or update dhcp by id in a private cloud workload network. @@ -946,15 +2379,19 @@ def begin_update_dhcp( :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDhcp"] lro_delay = kwargs.pop( 'polling_interval', @@ -967,28 +2404,21 @@ def begin_update_dhcp( private_cloud_name=private_cloud_name, dhcp_id=dhcp_id, workload_network_dhcp=workload_network_dhcp, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkDhcp', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dhcpId': self._serialize.url("dhcp_id", dhcp_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1000,43 +2430,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_dhcp.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore def _delete_dhcp_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - dhcp_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + private_cloud_name: str, + dhcp_id: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_dhcp_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dhcpId': self._serialize.url("dhcp_id", dhcp_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_dhcp_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dhcp_id=dhcp_id, + template_url=self._delete_dhcp_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1049,14 +2469,15 @@ def _delete_dhcp_initial( _delete_dhcp_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + + @distributed_trace def begin_delete_dhcp( self, - resource_group_name, # type: str - private_cloud_name, # type: str - dhcp_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + private_cloud_name: str, + dhcp_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete dhcp by id in a private cloud workload network. Delete dhcp by id in a private cloud workload network. @@ -1069,15 +2490,17 @@ def begin_delete_dhcp( :type dhcp_id: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1092,22 +2515,14 @@ def begin_delete_dhcp( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dhcpId': self._serialize.url("dhcp_id", dhcp_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1119,15 +2534,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_dhcp.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}'} # type: ignore + @distributed_trace def list_gateways( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WorkloadNetworkGatewayList"] + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> Iterable["_models.WorkloadNetworkGatewayList"]: """List of gateways in a private cloud workload network. List of gateways in a private cloud workload network. @@ -1137,7 +2553,8 @@ def list_gateways( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkGatewayList or the result of cls(response) + :return: An iterator like instance of either WorkloadNetworkGatewayList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkGatewayList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -1146,36 +2563,33 @@ def list_gateways( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_gateways.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_gateways_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list_gateways.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_gateways_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadNetworkGatewayList', pipeline_response) + deserialized = self._deserialize("WorkloadNetworkGatewayList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1193,19 +2607,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_gateways.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways'} # type: ignore + @distributed_trace def get_gateway( self, - resource_group_name, # type: str - private_cloud_name, # type: str - gateway_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkloadNetworkGateway" + resource_group_name: str, + private_cloud_name: str, + gateway_id: str, + **kwargs: Any + ) -> "_models.WorkloadNetworkGateway": """Get a gateway by id in a private cloud workload network. Get a gateway by id in a private cloud workload network. @@ -1226,28 +2641,18 @@ def get_gateway( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_gateway.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_gateway_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + gateway_id=gateway_id, + template_url=self.get_gateway.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1261,15 +2666,17 @@ def get_gateway( return cls(pipeline_response, deserialized, {}) return deserialized + get_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId}'} # type: ignore + + @distributed_trace def list_port_mirroring( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WorkloadNetworkPortMirroringList"] + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> Iterable["_models.WorkloadNetworkPortMirroringList"]: """List of port mirroring profiles in a private cloud workload network. List of port mirroring profiles in a private cloud workload network. @@ -1279,7 +2686,8 @@ def list_port_mirroring( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkPortMirroringList or the result of cls(response) + :return: An iterator like instance of either WorkloadNetworkPortMirroringList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPortMirroringList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -1288,36 +2696,33 @@ def list_port_mirroring( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_port_mirroring.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_port_mirroring_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list_port_mirroring.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_port_mirroring_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadNetworkPortMirroringList', pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPortMirroringList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1335,19 +2740,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_port_mirroring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles'} # type: ignore + @distributed_trace def get_port_mirroring( self, - resource_group_name, # type: str - private_cloud_name, # type: str - port_mirroring_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkloadNetworkPortMirroring" + resource_group_name: str, + private_cloud_name: str, + port_mirroring_id: str, + **kwargs: Any + ) -> "_models.WorkloadNetworkPortMirroring": """Get a port mirroring profile by id in a private cloud workload network. Get a port mirroring profile by id in a private cloud workload network. @@ -1369,28 +2775,18 @@ def get_port_mirroring( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_port_mirroring.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_port_mirroring_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + port_mirroring_id=port_mirroring_id, + template_url=self.get_port_mirroring.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1404,49 +2800,40 @@ def get_port_mirroring( return cls(pipeline_response, deserialized, {}) return deserialized + get_port_mirroring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + def _create_port_mirroring_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - port_mirroring_id, # type: str - workload_network_port_mirroring, # type: "_models.WorkloadNetworkPortMirroring" - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkloadNetworkPortMirroring" + resource_group_name: str, + private_cloud_name: str, + port_mirroring_id: str, + workload_network_port_mirroring: "_models.WorkloadNetworkPortMirroring", + **kwargs: Any + ) -> "_models.WorkloadNetworkPortMirroring": cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPortMirroring"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_port_mirroring_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(workload_network_port_mirroring, 'WorkloadNetworkPortMirroring') - # 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') + request = build_create_port_mirroring_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + port_mirroring_id=port_mirroring_id, + content_type=content_type, + json=_json, + template_url=self._create_port_mirroring_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_port_mirroring, 'WorkloadNetworkPortMirroring') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1464,17 +2851,19 @@ def _create_port_mirroring_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_port_mirroring_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + + @distributed_trace def begin_create_port_mirroring( self, - resource_group_name, # type: str - private_cloud_name, # type: str - port_mirroring_id, # type: str - workload_network_port_mirroring, # type: "_models.WorkloadNetworkPortMirroring" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WorkloadNetworkPortMirroring"] + resource_group_name: str, + private_cloud_name: str, + port_mirroring_id: str, + workload_network_port_mirroring: "_models.WorkloadNetworkPortMirroring", + **kwargs: Any + ) -> LROPoller["_models.WorkloadNetworkPortMirroring"]: """Create a port mirroring profile by id in a private cloud workload network. Create a port mirroring profile by id in a private cloud workload network. @@ -1490,15 +2879,19 @@ def begin_create_port_mirroring( :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the + result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPortMirroring"] lro_delay = kwargs.pop( 'polling_interval', @@ -1511,28 +2904,21 @@ def begin_create_port_mirroring( private_cloud_name=private_cloud_name, port_mirroring_id=port_mirroring_id, workload_network_port_mirroring=workload_network_port_mirroring, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkPortMirroring', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1544,49 +2930,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_port_mirroring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore def _update_port_mirroring_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - port_mirroring_id, # type: str - workload_network_port_mirroring, # type: "_models.WorkloadNetworkPortMirroring" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.WorkloadNetworkPortMirroring"] + resource_group_name: str, + private_cloud_name: str, + port_mirroring_id: str, + workload_network_port_mirroring: "_models.WorkloadNetworkPortMirroring", + **kwargs: Any + ) -> Optional["_models.WorkloadNetworkPortMirroring"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WorkloadNetworkPortMirroring"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_port_mirroring_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(workload_network_port_mirroring, 'WorkloadNetworkPortMirroring') + + request = build_update_port_mirroring_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + port_mirroring_id=port_mirroring_id, + content_type=content_type, + json=_json, + template_url=self._update_port_mirroring_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_port_mirroring, 'WorkloadNetworkPortMirroring') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1602,17 +2978,19 @@ def _update_port_mirroring_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_port_mirroring_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + + @distributed_trace def begin_update_port_mirroring( self, - resource_group_name, # type: str - private_cloud_name, # type: str - port_mirroring_id, # type: str - workload_network_port_mirroring, # type: "_models.WorkloadNetworkPortMirroring" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WorkloadNetworkPortMirroring"] + resource_group_name: str, + private_cloud_name: str, + port_mirroring_id: str, + workload_network_port_mirroring: "_models.WorkloadNetworkPortMirroring", + **kwargs: Any + ) -> LROPoller["_models.WorkloadNetworkPortMirroring"]: """Create or update a port mirroring profile by id in a private cloud workload network. Create or update a port mirroring profile by id in a private cloud workload network. @@ -1628,15 +3006,19 @@ def begin_update_port_mirroring( :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the + result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPortMirroring"] lro_delay = kwargs.pop( 'polling_interval', @@ -1649,28 +3031,21 @@ def begin_update_port_mirroring( private_cloud_name=private_cloud_name, port_mirroring_id=port_mirroring_id, workload_network_port_mirroring=workload_network_port_mirroring, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkPortMirroring', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1682,43 +3057,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_port_mirroring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore def _delete_port_mirroring_initial( self, - resource_group_name, # type: str - port_mirroring_id, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + port_mirroring_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_port_mirroring_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_port_mirroring_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + port_mirroring_id=port_mirroring_id, + private_cloud_name=private_cloud_name, + template_url=self._delete_port_mirroring_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1731,14 +3096,15 @@ def _delete_port_mirroring_initial( _delete_port_mirroring_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + + @distributed_trace def begin_delete_port_mirroring( self, - resource_group_name, # type: str - port_mirroring_id, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + port_mirroring_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a port mirroring profile by id in a private cloud workload network. Delete a port mirroring profile by id in a private cloud workload network. @@ -1752,15 +3118,17 @@ def begin_delete_port_mirroring( :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1775,22 +3143,14 @@ def begin_delete_port_mirroring( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'portMirroringId': self._serialize.url("port_mirroring_id", port_mirroring_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1802,15 +3162,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_port_mirroring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}'} # type: ignore + @distributed_trace def list_vm_groups( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WorkloadNetworkVMGroupsList"] + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> Iterable["_models.WorkloadNetworkVMGroupsList"]: """List of vm groups in a private cloud workload network. List of vm groups in a private cloud workload network. @@ -1820,7 +3181,8 @@ def list_vm_groups( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkVMGroupsList or the result of cls(response) + :return: An iterator like instance of either WorkloadNetworkVMGroupsList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVMGroupsList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -1829,36 +3191,33 @@ def list_vm_groups( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_vm_groups.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_vm_groups_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list_vm_groups.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_vm_groups_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadNetworkVMGroupsList', pipeline_response) + deserialized = self._deserialize("WorkloadNetworkVMGroupsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1876,19 +3235,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_vm_groups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups'} # type: ignore + @distributed_trace def get_vm_group( self, - resource_group_name, # type: str - private_cloud_name, # type: str - vm_group_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkloadNetworkVMGroup" + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + **kwargs: Any + ) -> "_models.WorkloadNetworkVMGroup": """Get a vm group by id in a private cloud workload network. Get a vm group by id in a private cloud workload network. @@ -1909,28 +3269,18 @@ def get_vm_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_vm_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'vmGroupId': self._serialize.url("vm_group_id", vm_group_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_vm_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + vm_group_id=vm_group_id, + template_url=self.get_vm_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1944,49 +3294,40 @@ def get_vm_group( return cls(pipeline_response, deserialized, {}) return deserialized + get_vm_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + def _create_vm_group_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - vm_group_id, # type: str - workload_network_vm_group, # type: "_models.WorkloadNetworkVMGroup" - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkloadNetworkVMGroup" + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + workload_network_vm_group: "_models.WorkloadNetworkVMGroup", + **kwargs: Any + ) -> "_models.WorkloadNetworkVMGroup": cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVMGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_vm_group_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'vmGroupId': self._serialize.url("vm_group_id", vm_group_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(workload_network_vm_group, 'WorkloadNetworkVMGroup') - # 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') + request = build_create_vm_group_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + vm_group_id=vm_group_id, + content_type=content_type, + json=_json, + template_url=self._create_vm_group_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_vm_group, 'WorkloadNetworkVMGroup') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2004,17 +3345,19 @@ def _create_vm_group_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_vm_group_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + + @distributed_trace def begin_create_vm_group( self, - resource_group_name, # type: str - private_cloud_name, # type: str - vm_group_id, # type: str - workload_network_vm_group, # type: "_models.WorkloadNetworkVMGroup" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WorkloadNetworkVMGroup"] + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + workload_network_vm_group: "_models.WorkloadNetworkVMGroup", + **kwargs: Any + ) -> LROPoller["_models.WorkloadNetworkVMGroup"]: """Create a vm group by id in a private cloud workload network. Create a vm group by id in a private cloud workload network. @@ -2029,15 +3372,19 @@ def begin_create_vm_group( :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVMGroup"] lro_delay = kwargs.pop( 'polling_interval', @@ -2050,28 +3397,21 @@ def begin_create_vm_group( private_cloud_name=private_cloud_name, vm_group_id=vm_group_id, workload_network_vm_group=workload_network_vm_group, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkVMGroup', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'vmGroupId': self._serialize.url("vm_group_id", vm_group_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2083,49 +3423,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_vm_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore def _update_vm_group_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - vm_group_id, # type: str - workload_network_vm_group, # type: "_models.WorkloadNetworkVMGroup" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.WorkloadNetworkVMGroup"] + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + workload_network_vm_group: "_models.WorkloadNetworkVMGroup", + **kwargs: Any + ) -> Optional["_models.WorkloadNetworkVMGroup"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WorkloadNetworkVMGroup"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_vm_group_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'vmGroupId': self._serialize.url("vm_group_id", vm_group_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(workload_network_vm_group, 'WorkloadNetworkVMGroup') - # 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') + request = build_update_vm_group_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + vm_group_id=vm_group_id, + content_type=content_type, + json=_json, + template_url=self._update_vm_group_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_vm_group, 'WorkloadNetworkVMGroup') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2141,17 +3471,19 @@ def _update_vm_group_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_vm_group_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + + @distributed_trace def begin_update_vm_group( self, - resource_group_name, # type: str - private_cloud_name, # type: str - vm_group_id, # type: str - workload_network_vm_group, # type: "_models.WorkloadNetworkVMGroup" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WorkloadNetworkVMGroup"] + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + workload_network_vm_group: "_models.WorkloadNetworkVMGroup", + **kwargs: Any + ) -> LROPoller["_models.WorkloadNetworkVMGroup"]: """Create or update a vm group by id in a private cloud workload network. Create or update a vm group by id in a private cloud workload network. @@ -2166,15 +3498,19 @@ def begin_update_vm_group( :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkVMGroup"] lro_delay = kwargs.pop( 'polling_interval', @@ -2187,28 +3523,21 @@ def begin_update_vm_group( private_cloud_name=private_cloud_name, vm_group_id=vm_group_id, workload_network_vm_group=workload_network_vm_group, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkVMGroup', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'vmGroupId': self._serialize.url("vm_group_id", vm_group_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2220,43 +3549,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_vm_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore def _delete_vm_group_initial( self, - resource_group_name, # type: str - vm_group_id, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vm_group_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_vm_group_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'vmGroupId': self._serialize.url("vm_group_id", vm_group_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_vm_group_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vm_group_id=vm_group_id, + private_cloud_name=private_cloud_name, + template_url=self._delete_vm_group_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2269,14 +3588,15 @@ def _delete_vm_group_initial( _delete_vm_group_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + + @distributed_trace def begin_delete_vm_group( self, - resource_group_name, # type: str - vm_group_id, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + vm_group_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a vm group by id in a private cloud workload network. Delete a vm group by id in a private cloud workload network. @@ -2289,15 +3609,17 @@ def begin_delete_vm_group( :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2312,22 +3634,14 @@ def begin_delete_vm_group( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'vmGroupId': self._serialize.url("vm_group_id", vm_group_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2339,15 +3653,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_vm_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}'} # type: ignore + @distributed_trace def list_virtual_machines( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WorkloadNetworkVirtualMachinesList"] + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> Iterable["_models.WorkloadNetworkVirtualMachinesList"]: """List of virtual machines in a private cloud workload network. List of virtual machines in a private cloud workload network. @@ -2357,7 +3672,8 @@ def list_virtual_machines( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkVirtualMachinesList or the result of cls(response) + :return: An iterator like instance of either WorkloadNetworkVirtualMachinesList or the result + of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVirtualMachinesList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -2366,36 +3682,33 @@ def list_virtual_machines( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_virtual_machines.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_virtual_machines_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list_virtual_machines.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_virtual_machines_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadNetworkVirtualMachinesList', pipeline_response) + deserialized = self._deserialize("WorkloadNetworkVirtualMachinesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -2413,19 +3726,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_virtual_machines.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines'} # type: ignore + @distributed_trace def get_virtual_machine( self, - resource_group_name, # type: str - private_cloud_name, # type: str - virtual_machine_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkloadNetworkVirtualMachine" + resource_group_name: str, + private_cloud_name: str, + virtual_machine_id: str, + **kwargs: Any + ) -> "_models.WorkloadNetworkVirtualMachine": """Get a virtual machine by id in a private cloud workload network. Get a virtual machine by id in a private cloud workload network. @@ -2446,28 +3760,18 @@ def get_virtual_machine( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_virtual_machine.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'virtualMachineId': self._serialize.url("virtual_machine_id", virtual_machine_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_virtual_machine_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + virtual_machine_id=virtual_machine_id, + template_url=self.get_virtual_machine.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2481,15 +3785,17 @@ def get_virtual_machine( return cls(pipeline_response, deserialized, {}) return deserialized + get_virtual_machine.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId}'} # type: ignore + + @distributed_trace def list_dns_services( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WorkloadNetworkDnsServicesList"] + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> Iterable["_models.WorkloadNetworkDnsServicesList"]: """List of DNS services in a private cloud workload network. List of DNS services in a private cloud workload network. @@ -2499,7 +3805,8 @@ def list_dns_services( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkDnsServicesList or the result of cls(response) + :return: An iterator like instance of either WorkloadNetworkDnsServicesList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsServicesList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -2508,36 +3815,33 @@ def list_dns_services( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_dns_services.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_dns_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list_dns_services.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_dns_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadNetworkDnsServicesList', pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsServicesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -2555,19 +3859,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_dns_services.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices'} # type: ignore + @distributed_trace def get_dns_service( self, - resource_group_name, # type: str - private_cloud_name, # type: str - dns_service_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkloadNetworkDnsService" + resource_group_name: str, + private_cloud_name: str, + dns_service_id: str, + **kwargs: Any + ) -> "_models.WorkloadNetworkDnsService": """Get a DNS service by id in a private cloud workload network. Get a DNS service by id in a private cloud workload network. @@ -2589,28 +3894,18 @@ def get_dns_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_dns_service.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_dns_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_service_id=dns_service_id, + template_url=self.get_dns_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2624,49 +3919,40 @@ def get_dns_service( return cls(pipeline_response, deserialized, {}) return deserialized + get_dns_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + def _create_dns_service_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - dns_service_id, # type: str - workload_network_dns_service, # type: "_models.WorkloadNetworkDnsService" - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkloadNetworkDnsService" + resource_group_name: str, + private_cloud_name: str, + dns_service_id: str, + workload_network_dns_service: "_models.WorkloadNetworkDnsService", + **kwargs: Any + ) -> "_models.WorkloadNetworkDnsService": cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsService"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_dns_service_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(workload_network_dns_service, 'WorkloadNetworkDnsService') + + request = build_create_dns_service_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_service_id=dns_service_id, + content_type=content_type, + json=_json, + template_url=self._create_dns_service_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_dns_service, 'WorkloadNetworkDnsService') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2684,17 +3970,19 @@ def _create_dns_service_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_dns_service_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + + @distributed_trace def begin_create_dns_service( self, - resource_group_name, # type: str - private_cloud_name, # type: str - dns_service_id, # type: str - workload_network_dns_service, # type: "_models.WorkloadNetworkDnsService" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WorkloadNetworkDnsService"] + resource_group_name: str, + private_cloud_name: str, + dns_service_id: str, + workload_network_dns_service: "_models.WorkloadNetworkDnsService", + **kwargs: Any + ) -> LROPoller["_models.WorkloadNetworkDnsService"]: """Create a DNS service by id in a private cloud workload network. Create a DNS service by id in a private cloud workload network. @@ -2710,15 +3998,19 @@ def begin_create_dns_service( :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result + of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsService"] lro_delay = kwargs.pop( 'polling_interval', @@ -2731,28 +4023,21 @@ def begin_create_dns_service( private_cloud_name=private_cloud_name, dns_service_id=dns_service_id, workload_network_dns_service=workload_network_dns_service, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkDnsService', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2764,49 +4049,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_dns_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore def _update_dns_service_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - dns_service_id, # type: str - workload_network_dns_service, # type: "_models.WorkloadNetworkDnsService" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.WorkloadNetworkDnsService"] + resource_group_name: str, + private_cloud_name: str, + dns_service_id: str, + workload_network_dns_service: "_models.WorkloadNetworkDnsService", + **kwargs: Any + ) -> Optional["_models.WorkloadNetworkDnsService"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WorkloadNetworkDnsService"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_dns_service_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(workload_network_dns_service, 'WorkloadNetworkDnsService') + + request = build_update_dns_service_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_service_id=dns_service_id, + content_type=content_type, + json=_json, + template_url=self._update_dns_service_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_dns_service, 'WorkloadNetworkDnsService') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2822,17 +4097,19 @@ def _update_dns_service_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_dns_service_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + + @distributed_trace def begin_update_dns_service( self, - resource_group_name, # type: str - private_cloud_name, # type: str - dns_service_id, # type: str - workload_network_dns_service, # type: "_models.WorkloadNetworkDnsService" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WorkloadNetworkDnsService"] + resource_group_name: str, + private_cloud_name: str, + dns_service_id: str, + workload_network_dns_service: "_models.WorkloadNetworkDnsService", + **kwargs: Any + ) -> LROPoller["_models.WorkloadNetworkDnsService"]: """Create or update a DNS service by id in a private cloud workload network. Create or update a DNS service by id in a private cloud workload network. @@ -2848,15 +4125,19 @@ def begin_update_dns_service( :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result + of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsService"] lro_delay = kwargs.pop( 'polling_interval', @@ -2869,28 +4150,21 @@ def begin_update_dns_service( private_cloud_name=private_cloud_name, dns_service_id=dns_service_id, workload_network_dns_service=workload_network_dns_service, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkDnsService', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2902,43 +4176,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_dns_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore def _delete_dns_service_initial( self, - resource_group_name, # type: str - dns_service_id, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + dns_service_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_dns_service_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_dns_service_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + dns_service_id=dns_service_id, + private_cloud_name=private_cloud_name, + template_url=self._delete_dns_service_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2951,14 +4215,15 @@ def _delete_dns_service_initial( _delete_dns_service_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + + @distributed_trace def begin_delete_dns_service( self, - resource_group_name, # type: str - dns_service_id, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + dns_service_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a DNS service by id in a private cloud workload network. Delete a DNS service by id in a private cloud workload network. @@ -2972,15 +4237,17 @@ def begin_delete_dns_service( :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2995,22 +4262,14 @@ def begin_delete_dns_service( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'dnsServiceId': self._serialize.url("dns_service_id", dns_service_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -3022,15 +4281,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_dns_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}'} # type: ignore + @distributed_trace def list_dns_zones( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WorkloadNetworkDnsZonesList"] + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> Iterable["_models.WorkloadNetworkDnsZonesList"]: """List of DNS zones in a private cloud workload network. List of DNS zones in a private cloud workload network. @@ -3040,7 +4300,8 @@ def list_dns_zones( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkDnsZonesList or the result of cls(response) + :return: An iterator like instance of either WorkloadNetworkDnsZonesList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsZonesList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -3049,36 +4310,33 @@ def list_dns_zones( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_dns_zones.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_dns_zones_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list_dns_zones.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_dns_zones_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadNetworkDnsZonesList', pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsZonesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -3096,19 +4354,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_dns_zones.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones'} # type: ignore + @distributed_trace def get_dns_zone( self, - resource_group_name, # type: str - private_cloud_name, # type: str - dns_zone_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkloadNetworkDnsZone" + resource_group_name: str, + private_cloud_name: str, + dns_zone_id: str, + **kwargs: Any + ) -> "_models.WorkloadNetworkDnsZone": """Get a DNS zone by id in a private cloud workload network. Get a DNS zone by id in a private cloud workload network. @@ -3129,28 +4388,18 @@ def get_dns_zone( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_dns_zone.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_dns_zone_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_zone_id=dns_zone_id, + template_url=self.get_dns_zone.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3164,49 +4413,40 @@ def get_dns_zone( return cls(pipeline_response, deserialized, {}) return deserialized + get_dns_zone.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + def _create_dns_zone_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - dns_zone_id, # type: str - workload_network_dns_zone, # type: "_models.WorkloadNetworkDnsZone" - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkloadNetworkDnsZone" + resource_group_name: str, + private_cloud_name: str, + dns_zone_id: str, + workload_network_dns_zone: "_models.WorkloadNetworkDnsZone", + **kwargs: Any + ) -> "_models.WorkloadNetworkDnsZone": cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsZone"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_dns_zone_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(workload_network_dns_zone, 'WorkloadNetworkDnsZone') + + request = build_create_dns_zone_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_zone_id=dns_zone_id, + content_type=content_type, + json=_json, + template_url=self._create_dns_zone_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_dns_zone, 'WorkloadNetworkDnsZone') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3224,17 +4464,19 @@ def _create_dns_zone_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_dns_zone_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + + @distributed_trace def begin_create_dns_zone( self, - resource_group_name, # type: str - private_cloud_name, # type: str - dns_zone_id, # type: str - workload_network_dns_zone, # type: "_models.WorkloadNetworkDnsZone" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WorkloadNetworkDnsZone"] + resource_group_name: str, + private_cloud_name: str, + dns_zone_id: str, + workload_network_dns_zone: "_models.WorkloadNetworkDnsZone", + **kwargs: Any + ) -> LROPoller["_models.WorkloadNetworkDnsZone"]: """Create a DNS zone by id in a private cloud workload network. Create a DNS zone by id in a private cloud workload network. @@ -3249,15 +4491,19 @@ def begin_create_dns_zone( :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsZone"] lro_delay = kwargs.pop( 'polling_interval', @@ -3270,28 +4516,21 @@ def begin_create_dns_zone( private_cloud_name=private_cloud_name, dns_zone_id=dns_zone_id, workload_network_dns_zone=workload_network_dns_zone, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkDnsZone', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -3303,49 +4542,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_dns_zone.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore def _update_dns_zone_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - dns_zone_id, # type: str - workload_network_dns_zone, # type: "_models.WorkloadNetworkDnsZone" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.WorkloadNetworkDnsZone"] + resource_group_name: str, + private_cloud_name: str, + dns_zone_id: str, + workload_network_dns_zone: "_models.WorkloadNetworkDnsZone", + **kwargs: Any + ) -> Optional["_models.WorkloadNetworkDnsZone"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WorkloadNetworkDnsZone"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_dns_zone_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(workload_network_dns_zone, 'WorkloadNetworkDnsZone') - # 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') + request = build_update_dns_zone_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_zone_id=dns_zone_id, + content_type=content_type, + json=_json, + template_url=self._update_dns_zone_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_dns_zone, 'WorkloadNetworkDnsZone') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3361,17 +4590,19 @@ def _update_dns_zone_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_dns_zone_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + + @distributed_trace def begin_update_dns_zone( self, - resource_group_name, # type: str - private_cloud_name, # type: str - dns_zone_id, # type: str - workload_network_dns_zone, # type: "_models.WorkloadNetworkDnsZone" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WorkloadNetworkDnsZone"] + resource_group_name: str, + private_cloud_name: str, + dns_zone_id: str, + workload_network_dns_zone: "_models.WorkloadNetworkDnsZone", + **kwargs: Any + ) -> LROPoller["_models.WorkloadNetworkDnsZone"]: """Create or update a DNS zone by id in a private cloud workload network. Create or update a DNS zone by id in a private cloud workload network. @@ -3386,15 +4617,19 @@ def begin_update_dns_zone( :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkDnsZone"] lro_delay = kwargs.pop( 'polling_interval', @@ -3407,28 +4642,21 @@ def begin_update_dns_zone( private_cloud_name=private_cloud_name, dns_zone_id=dns_zone_id, workload_network_dns_zone=workload_network_dns_zone, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkDnsZone', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -3440,43 +4668,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_dns_zone.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore def _delete_dns_zone_initial( self, - resource_group_name, # type: str - dns_zone_id, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + dns_zone_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_dns_zone_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_dns_zone_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + dns_zone_id=dns_zone_id, + private_cloud_name=private_cloud_name, + template_url=self._delete_dns_zone_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3489,14 +4707,15 @@ def _delete_dns_zone_initial( _delete_dns_zone_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + + @distributed_trace def begin_delete_dns_zone( self, - resource_group_name, # type: str - dns_zone_id, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + dns_zone_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a DNS zone by id in a private cloud workload network. Delete a DNS zone by id in a private cloud workload network. @@ -3509,15 +4728,17 @@ def begin_delete_dns_zone( :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -3532,22 +4753,14 @@ def begin_delete_dns_zone( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'dnsZoneId': self._serialize.url("dns_zone_id", dns_zone_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -3559,15 +4772,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_dns_zone.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}'} # type: ignore + @distributed_trace def list_public_i_ps( self, - resource_group_name, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WorkloadNetworkPublicIPsList"] + resource_group_name: str, + private_cloud_name: str, + **kwargs: Any + ) -> Iterable["_models.WorkloadNetworkPublicIPsList"]: """List of Public IP Blocks in a private cloud workload network. List of Public IP Blocks in a private cloud workload network. @@ -3577,7 +4791,8 @@ def list_public_i_ps( :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkPublicIPsList or the result of cls(response) + :return: An iterator like instance of either WorkloadNetworkPublicIPsList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPublicIPsList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -3586,36 +4801,33 @@ def list_public_i_ps( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_public_i_ps.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_public_i_ps_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=self.list_public_i_ps.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_public_i_ps_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadNetworkPublicIPsList', pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPublicIPsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -3633,19 +4845,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_public_i_ps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs'} # type: ignore + @distributed_trace def get_public_ip( self, - resource_group_name, # type: str - private_cloud_name, # type: str - public_ip_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkloadNetworkPublicIP" + resource_group_name: str, + private_cloud_name: str, + public_ip_id: str, + **kwargs: Any + ) -> "_models.WorkloadNetworkPublicIP": """Get a Public IP Block by id in a private cloud workload network. Get a Public IP Block by id in a private cloud workload network. @@ -3667,28 +4880,18 @@ def get_public_ip( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_public_ip.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'publicIPId': self._serialize.url("public_ip_id", public_ip_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_public_ip_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + public_ip_id=public_ip_id, + template_url=self.get_public_ip.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3702,49 +4905,40 @@ def get_public_ip( return cls(pipeline_response, deserialized, {}) return deserialized + get_public_ip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}'} # type: ignore + def _create_public_ip_initial( self, - resource_group_name, # type: str - private_cloud_name, # type: str - public_ip_id, # type: str - workload_network_public_ip, # type: "_models.WorkloadNetworkPublicIP" - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkloadNetworkPublicIP" + resource_group_name: str, + private_cloud_name: str, + public_ip_id: str, + workload_network_public_ip: "_models.WorkloadNetworkPublicIP", + **kwargs: Any + ) -> "_models.WorkloadNetworkPublicIP": cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPublicIP"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_public_ip_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'publicIPId': self._serialize.url("public_ip_id", public_ip_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(workload_network_public_ip, 'WorkloadNetworkPublicIP') + + request = build_create_public_ip_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + public_ip_id=public_ip_id, + content_type=content_type, + json=_json, + template_url=self._create_public_ip_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workload_network_public_ip, 'WorkloadNetworkPublicIP') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3762,17 +4956,19 @@ def _create_public_ip_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_public_ip_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}'} # type: ignore + + @distributed_trace def begin_create_public_ip( self, - resource_group_name, # type: str - private_cloud_name, # type: str - public_ip_id, # type: str - workload_network_public_ip, # type: "_models.WorkloadNetworkPublicIP" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WorkloadNetworkPublicIP"] + resource_group_name: str, + private_cloud_name: str, + public_ip_id: str, + workload_network_public_ip: "_models.WorkloadNetworkPublicIP", + **kwargs: Any + ) -> LROPoller["_models.WorkloadNetworkPublicIP"]: """Create a Public IP Block by id in a private cloud workload network. Create a Public IP Block by id in a private cloud workload network. @@ -3788,15 +4984,19 @@ def begin_create_public_ip( :type workload_network_public_ip: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either WorkloadNetworkPublicIP or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadNetworkPublicIP or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadNetworkPublicIP"] lro_delay = kwargs.pop( 'polling_interval', @@ -3809,28 +5009,21 @@ def begin_create_public_ip( private_cloud_name=private_cloud_name, public_ip_id=public_ip_id, workload_network_public_ip=workload_network_public_ip, + content_type=content_type, 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 = pipeline_response.http_response deserialized = self._deserialize('WorkloadNetworkPublicIP', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - 'publicIPId': self._serialize.url("public_ip_id", public_ip_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -3842,43 +5035,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_public_ip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}'} # type: ignore def _delete_public_ip_initial( self, - resource_group_name, # type: str - public_ip_id, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + public_ip_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_public_ip_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'publicIPId': self._serialize.url("public_ip_id", public_ip_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_public_ip_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + public_ip_id=public_ip_id, + private_cloud_name=private_cloud_name, + template_url=self._delete_public_ip_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3891,14 +5074,15 @@ def _delete_public_ip_initial( _delete_public_ip_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}'} # type: ignore + + @distributed_trace def begin_delete_public_ip( self, - resource_group_name, # type: str - public_ip_id, # type: str - private_cloud_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + public_ip_id: str, + private_cloud_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a Public IP Block by id in a private cloud workload network. Delete a Public IP Block by id in a private cloud workload network. @@ -3912,15 +5096,17 @@ def begin_delete_public_ip( :type private_cloud_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -3935,22 +5121,14 @@ def begin_delete_public_ip( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'publicIPId': self._serialize.url("public_ip_id", public_ip_id, 'str'), - 'privateCloudName': self._serialize.url("private_cloud_name", private_cloud_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -3962,4 +5140,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_public_ip.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}'} # type: ignore