From d0414a8c703ca418de8277f803b6c95bf2bc4369 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 7 Dec 2020 05:00:12 +0000 Subject: [PATCH] CodeGen from PR 11383 in Azure/azure-rest-api-specs adding the field on which on which summary is done in the response (#11383) Co-authored-by: Durgesh Kumar --- .../azure/mgmt/resourcemover/__init__.py | 2 +- .../mgmt/resourcemover/_configuration.py | 5 +- .../azure/mgmt/resourcemover/_metadata.json | 24 +- .../azure/mgmt/resourcemover/_version.py | 2 +- .../azure/mgmt/resourcemover/aio/__init__.py | 2 +- .../mgmt/resourcemover/aio/_configuration.py | 67 + .../aio/_resource_mover_service_api.py | 78 + .../resourcemover/aio/operations/__init__.py | 19 + .../_move_collections_operations.py | 1279 +++++++++++++++++ .../operations/_move_resources_operations.py | 445 ++++++ .../_operations_discovery_operations.py | 87 ++ .../_unresolved_dependencies_operations.py | 99 ++ .../mgmt/resourcemover/models/__init__.py | 14 +- .../mgmt/resourcemover/models/_models.py | 151 +- .../mgmt/resourcemover/models/_models_py3.py | 165 ++- .../_resource_mover_service_api_enums.py | 110 +- .../_move_collections_operations.py | 390 +++-- .../operations/_move_resources_operations.py | 83 +- .../_operations_discovery_operations.py | 17 +- .../_unresolved_dependencies_operations.py | 17 +- 20 files changed, 2757 insertions(+), 299 deletions(-) create mode 100644 sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/_configuration.py create mode 100644 sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/_resource_mover_service_api.py create mode 100644 sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/__init__.py create mode 100644 sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_move_collections_operations.py create mode 100644 sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_move_resources_operations.py create mode 100644 sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_operations_discovery_operations.py create mode 100644 sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_unresolved_dependencies_operations.py diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/__init__.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/__init__.py index a26441be9fd6..055e320b7ba3 100644 --- a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/__init__.py +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/__init__.py @@ -13,7 +13,7 @@ __all__ = ['ResourceMoverServiceAPI'] try: - from ._patch import patch_sdk + from ._patch import patch_sdk # type: ignore patch_sdk() except ImportError: pass diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/_configuration.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/_configuration.py index e95a95d31b28..d5a87ef6e72d 100644 --- a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/_configuration.py +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/_configuration.py @@ -10,6 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy from ._version import VERSION @@ -48,8 +49,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2019-10-01-preview" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-resourcemover/{}'.format(VERSION)) self._configure(**kwargs) @@ -62,6 +62,7 @@ def _configure( self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/_metadata.json b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/_metadata.json index eb6983123964..74f2d1abe6ff 100644 --- a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/_metadata.json +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/_metadata.json @@ -4,32 +4,37 @@ "client": { "name": "ResourceMoverServiceAPI", "filename": "_resource_mover_service_api", - "description": "A first party Azure service orchestrating the move of Azure resources from one Azure region to another or between zones within a region." + "description": "A first party Azure service orchestrating the move of Azure resources from one Azure region to another or between zones within a region.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The Subscription ID.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The Subscription ID.", "docstring_type": "str", "required": true @@ -41,7 +46,10 @@ }, "config": { "credential": true, - "credential_scopes": ["https://management.azure.com/.default"] + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null }, "operation_groups": { "move_collections": "MoveCollectionsOperations", diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/_version.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/_version.py index 3fa7978c637e..95e84007ac63 100644 --- a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/_version.py +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.1b1" +VERSION = "0.1.0-preview" diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/__init__.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/__init__.py index 30a18f6e7433..f487634cb60f 100644 --- a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/__init__.py +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._resource_mover_service_api_async import ResourceMoverServiceAPI +from ._resource_mover_service_api import ResourceMoverServiceAPI __all__ = ['ResourceMoverServiceAPI'] diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/_configuration.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/_configuration.py new file mode 100644 index 000000000000..dc633dacd553 --- /dev/null +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ResourceMoverServiceAPIConfiguration(Configuration): + """Configuration for ResourceMoverServiceAPI. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The Subscription ID. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ResourceMoverServiceAPIConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2019-10-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-resourcemover/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/_resource_mover_service_api.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/_resource_mover_service_api.py new file mode 100644 index 000000000000..b8db859a391f --- /dev/null +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/_resource_mover_service_api.py @@ -0,0 +1,78 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import ResourceMoverServiceAPIConfiguration +from .operations import MoveCollectionsOperations +from .operations import MoveResourcesOperations +from .operations import UnresolvedDependenciesOperations +from .operations import OperationsDiscoveryOperations +from .. import models + + +class ResourceMoverServiceAPI(object): + """A first party Azure service orchestrating the move of Azure resources from one Azure region to another or between zones within a region. + + :ivar move_collections: MoveCollectionsOperations operations + :vartype move_collections: resource_mover_service_api.aio.operations.MoveCollectionsOperations + :ivar move_resources: MoveResourcesOperations operations + :vartype move_resources: resource_mover_service_api.aio.operations.MoveResourcesOperations + :ivar unresolved_dependencies: UnresolvedDependenciesOperations operations + :vartype unresolved_dependencies: resource_mover_service_api.aio.operations.UnresolvedDependenciesOperations + :ivar operations_discovery: OperationsDiscoveryOperations operations + :vartype operations_discovery: resource_mover_service_api.aio.operations.OperationsDiscoveryOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The Subscription ID. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = ResourceMoverServiceAPIConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.move_collections = MoveCollectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.move_resources = MoveResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.unresolved_dependencies = UnresolvedDependenciesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations_discovery = OperationsDiscoveryOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ResourceMoverServiceAPI": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/__init__.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/__init__.py new file mode 100644 index 000000000000..fb98319827bc --- /dev/null +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._move_collections_operations import MoveCollectionsOperations +from ._move_resources_operations import MoveResourcesOperations +from ._unresolved_dependencies_operations import UnresolvedDependenciesOperations +from ._operations_discovery_operations import OperationsDiscoveryOperations + +__all__ = [ + 'MoveCollectionsOperations', + 'MoveResourcesOperations', + 'UnresolvedDependenciesOperations', + 'OperationsDiscoveryOperations', +] diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_move_collections_operations.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_move_collections_operations.py new file mode 100644 index 000000000000..561c25714780 --- /dev/null +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_move_collections_operations.py @@ -0,0 +1,1279 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MoveCollectionsOperations: + """MoveCollectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~resource_mover_service_api.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create( + self, + resource_group_name: str, + move_collection_name: str, + body: Optional["_models.MoveCollection"] = None, + **kwargs + ) -> "_models.MoveCollection": + """Creates or updates a move collection. + + :param resource_group_name: The Resource Group Name. + :type resource_group_name: str + :param move_collection_name: The Move Collection Name. + :type move_collection_name: str + :param body: + :type body: ~resource_mover_service_api.models.MoveCollection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MoveCollection, or the result of cls(response) + :rtype: ~resource_mover_service_api.models.MoveCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MoveCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'MoveCollection') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('MoveCollection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('MoveCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + move_collection_name: str, + body: Optional["_models.UpdateMoveCollectionRequest"] = None, + **kwargs + ) -> "_models.MoveCollection": + """Updates a move collection. + + :param resource_group_name: The Resource Group Name. + :type resource_group_name: str + :param move_collection_name: The Move Collection Name. + :type move_collection_name: str + :param body: + :type body: ~resource_mover_service_api.models.UpdateMoveCollectionRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MoveCollection, or the result of cls(response) + :rtype: ~resource_mover_service_api.models.MoveCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MoveCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'UpdateMoveCollectionRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MoveCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + move_collection_name: str, + **kwargs + ) -> Optional["_models.OperationStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatus"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + move_collection_name: str, + **kwargs + ) -> AsyncLROPoller["_models.OperationStatus"]: + """Deletes a move collection. + + :param resource_group_name: The Resource Group Name. + :type resource_group_name: str + :param move_collection_name: The Move Collection Name. + :type move_collection_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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~resource_mover_service_api.models.OperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + move_collection_name=move_collection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + move_collection_name: str, + **kwargs + ) -> "_models.MoveCollection": + """Gets the move collection. + + :param resource_group_name: The Resource Group Name. + :type resource_group_name: str + :param move_collection_name: The Move Collection Name. + :type move_collection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MoveCollection, or the result of cls(response) + :rtype: ~resource_mover_service_api.models.MoveCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MoveCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MoveCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}'} # type: ignore + + async def _prepare_initial( + self, + resource_group_name: str, + move_collection_name: str, + body: Optional["_models.PrepareRequest"] = None, + **kwargs + ) -> Optional["_models.OperationStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatus"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._prepare_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'PrepareRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _prepare_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/prepare'} # type: ignore + + async def begin_prepare( + self, + resource_group_name: str, + move_collection_name: str, + body: Optional["_models.PrepareRequest"] = None, + **kwargs + ) -> AsyncLROPoller["_models.OperationStatus"]: + """Initiates prepare for the set of resources included in the request body. The prepare operation + is on the moveResources that are in the moveState 'PreparePending' or 'PrepareFailed', on a + successful completion the moveResource moveState do a transition to MovePending. To aid the + user to prerequisite the operation the client can call operation with validateOnly property set + to true. + + :param resource_group_name: The Resource Group Name. + :type resource_group_name: str + :param move_collection_name: The Move Collection Name. + :type move_collection_name: str + :param body: + :type body: ~resource_mover_service_api.models.PrepareRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~resource_mover_service_api.models.OperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._prepare_initial( + resource_group_name=resource_group_name, + move_collection_name=move_collection_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_prepare.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/prepare'} # type: ignore + + async def _initiate_move_initial( + self, + resource_group_name: str, + move_collection_name: str, + body: Optional["_models.ResourceMoveRequest"] = None, + **kwargs + ) -> Optional["_models.OperationStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatus"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._initiate_move_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'ResourceMoveRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _initiate_move_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/initiateMove'} # type: ignore + + async def begin_initiate_move( + self, + resource_group_name: str, + move_collection_name: str, + body: Optional["_models.ResourceMoveRequest"] = None, + **kwargs + ) -> AsyncLROPoller["_models.OperationStatus"]: + """Moves the set of resources included in the request body. The move operation is triggered after + the moveResources are in the moveState 'MovePending' or 'MoveFailed', on a successful + completion the moveResource moveState do a transition to CommitPending. To aid the user to + prerequisite the operation the client can call operation with validateOnly property set to + true. + + :param resource_group_name: The Resource Group Name. + :type resource_group_name: str + :param move_collection_name: The Move Collection Name. + :type move_collection_name: str + :param body: + :type body: ~resource_mover_service_api.models.ResourceMoveRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~resource_mover_service_api.models.OperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._initiate_move_initial( + resource_group_name=resource_group_name, + move_collection_name=move_collection_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_initiate_move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/initiateMove'} # type: ignore + + async def _commit_initial( + self, + resource_group_name: str, + move_collection_name: str, + body: Optional["_models.CommitRequest"] = None, + **kwargs + ) -> Optional["_models.OperationStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatus"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._commit_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'CommitRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _commit_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/commit'} # type: ignore + + async def begin_commit( + self, + resource_group_name: str, + move_collection_name: str, + body: Optional["_models.CommitRequest"] = None, + **kwargs + ) -> AsyncLROPoller["_models.OperationStatus"]: + """Commits the set of resources included in the request body. The commit operation is triggered on + the moveResources in the moveState 'CommitPending' or 'CommitFailed', on a successful + completion the moveResource moveState do a transition to Committed. To aid the user to + prerequisite the operation the client can call operation with validateOnly property set to + true. + + :param resource_group_name: The Resource Group Name. + :type resource_group_name: str + :param move_collection_name: The Move Collection Name. + :type move_collection_name: str + :param body: + :type body: ~resource_mover_service_api.models.CommitRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~resource_mover_service_api.models.OperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._commit_initial( + resource_group_name=resource_group_name, + move_collection_name=move_collection_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_commit.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/commit'} # type: ignore + + async def _discard_initial( + self, + resource_group_name: str, + move_collection_name: str, + body: Optional["_models.DiscardRequest"] = None, + **kwargs + ) -> Optional["_models.OperationStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatus"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._discard_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DiscardRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _discard_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/discard'} # type: ignore + + async def begin_discard( + self, + resource_group_name: str, + move_collection_name: str, + body: Optional["_models.DiscardRequest"] = None, + **kwargs + ) -> AsyncLROPoller["_models.OperationStatus"]: + """Discards the set of resources included in the request body. The discard operation is triggered + on the moveResources in the moveState 'CommitPending' or 'DiscardFailed', on a successful + completion the moveResource moveState do a transition to MovePending. To aid the user to + prerequisite the operation the client can call operation with validateOnly property set to + true. + + :param resource_group_name: The Resource Group Name. + :type resource_group_name: str + :param move_collection_name: The Move Collection Name. + :type move_collection_name: str + :param body: + :type body: ~resource_mover_service_api.models.DiscardRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~resource_mover_service_api.models.OperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._discard_initial( + resource_group_name=resource_group_name, + move_collection_name=move_collection_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_discard.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/discard'} # type: ignore + + async def _resolve_dependencies_initial( + self, + resource_group_name: str, + move_collection_name: str, + **kwargs + ) -> Optional["_models.OperationStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatus"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01-preview" + accept = "application/json" + + # Construct URL + url = self._resolve_dependencies_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _resolve_dependencies_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/resolveDependencies'} # type: ignore + + async def begin_resolve_dependencies( + self, + resource_group_name: str, + move_collection_name: str, + **kwargs + ) -> AsyncLROPoller["_models.OperationStatus"]: + """Computes, resolves and validate the dependencies of the moveResources in the move collection. + + :param resource_group_name: The Resource Group Name. + :type resource_group_name: str + :param move_collection_name: The Move Collection Name. + :type move_collection_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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~resource_mover_service_api.models.OperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._resolve_dependencies_initial( + resource_group_name=resource_group_name, + move_collection_name=move_collection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_resolve_dependencies.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/resolveDependencies'} # type: ignore + + async def _bulk_remove_initial( + self, + resource_group_name: str, + move_collection_name: str, + body: Optional["_models.BulkRemoveRequest"] = None, + **kwargs + ) -> Optional["_models.OperationStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatus"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._bulk_remove_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'BulkRemoveRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _bulk_remove_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/bulkRemove'} # type: ignore + + async def begin_bulk_remove( + self, + resource_group_name: str, + move_collection_name: str, + body: Optional["_models.BulkRemoveRequest"] = None, + **kwargs + ) -> AsyncLROPoller["_models.OperationStatus"]: + """Removes the set of move resources included in the request body from move collection. The + orchestration is done by service. To aid the user to prerequisite the operation the client can + call operation with validateOnly property set to true. + + :param resource_group_name: + :type resource_group_name: str + :param move_collection_name: + :type move_collection_name: str + :param body: + :type body: ~resource_mover_service_api.models.BulkRemoveRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~resource_mover_service_api.models.OperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._bulk_remove_initial( + resource_group_name=resource_group_name, + move_collection_name=move_collection_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_bulk_remove.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/bulkRemove'} # type: ignore + + def list_move_collections_by_subscription( + self, + **kwargs + ) -> AsyncIterable["_models.MoveCollectionResultList"]: + """Get all Move Collections. + + Get all the Move Collections in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MoveCollectionResultList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~resource_mover_service_api.models.MoveCollectionResultList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MoveCollectionResultList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01-preview" + 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_move_collections_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('MoveCollectionResultList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_move_collections_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Migrate/moveCollections'} # type: ignore + + def list_move_collections_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.MoveCollectionResultList"]: + """Get all Move Collections. + + Get all the Move Collections in the resource group. + + :param resource_group_name: The Resource Group Name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MoveCollectionResultList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~resource_mover_service_api.models.MoveCollectionResultList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MoveCollectionResultList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01-preview" + 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_move_collections_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('MoveCollectionResultList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_move_collections_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections'} # type: ignore diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_move_resources_operations.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_move_resources_operations.py new file mode 100644 index 000000000000..6daed387c2b0 --- /dev/null +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_move_resources_operations.py @@ -0,0 +1,445 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MoveResourcesOperations: + """MoveResourcesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~resource_mover_service_api.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + move_collection_name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.MoveResourceCollection"]: + """Lists the Move Resources in the move collection. + + :param resource_group_name: The Resource Group Name. + :type resource_group_name: str + :param move_collection_name: The Move Collection Name. + :type move_collection_name: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=Properties/ProvisioningState eq 'Succeeded'. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MoveResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~resource_mover_service_api.models.MoveResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MoveResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01-preview" + 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('MoveResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + move_collection_name: str, + move_resource_name: str, + body: Optional["_models.MoveResource"] = None, + **kwargs + ) -> Optional["_models.MoveResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MoveResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + 'moveResourceName': self._serialize.url("move_resource_name", move_resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'MoveResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MoveResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources/{moveResourceName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + move_collection_name: str, + move_resource_name: str, + body: Optional["_models.MoveResource"] = None, + **kwargs + ) -> AsyncLROPoller["_models.MoveResource"]: + """Creates or updates a Move Resource in the move collection. + + :param resource_group_name: The Resource Group Name. + :type resource_group_name: str + :param move_collection_name: The Move Collection Name. + :type move_collection_name: str + :param move_resource_name: The Move Resource Name. + :type move_resource_name: str + :param body: + :type body: ~resource_mover_service_api.models.MoveResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MoveResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~resource_mover_service_api.models.MoveResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MoveResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + move_collection_name=move_collection_name, + move_resource_name=move_resource_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MoveResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + 'moveResourceName': self._serialize.url("move_resource_name", move_resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources/{moveResourceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + move_collection_name: str, + move_resource_name: str, + **kwargs + ) -> Optional["_models.OperationStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatus"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + 'moveResourceName': self._serialize.url("move_resource_name", move_resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources/{moveResourceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + move_collection_name: str, + move_resource_name: str, + **kwargs + ) -> AsyncLROPoller["_models.OperationStatus"]: + """Deletes a Move Resource from the move collection. + + :param resource_group_name: The Resource Group Name. + :type resource_group_name: str + :param move_collection_name: The Move Collection Name. + :type move_collection_name: str + :param move_resource_name: The Move Resource Name. + :type move_resource_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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~resource_mover_service_api.models.OperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + move_collection_name=move_collection_name, + move_resource_name=move_resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + 'moveResourceName': self._serialize.url("move_resource_name", move_resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources/{moveResourceName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + move_collection_name: str, + move_resource_name: str, + **kwargs + ) -> "_models.MoveResource": + """Gets the Move Resource. + + :param resource_group_name: The Resource Group Name. + :type resource_group_name: str + :param move_collection_name: The Move Collection Name. + :type move_collection_name: str + :param move_resource_name: The Move Resource Name. + :type move_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MoveResource, or the result of cls(response) + :rtype: ~resource_mover_service_api.models.MoveResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MoveResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + 'moveResourceName': self._serialize.url("move_resource_name", move_resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MoveResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources/{moveResourceName}'} # type: ignore diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_operations_discovery_operations.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_operations_discovery_operations.py new file mode 100644 index 000000000000..e0eed18210bb --- /dev/null +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_operations_discovery_operations.py @@ -0,0 +1,87 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationsDiscoveryOperations: + """OperationsDiscoveryOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~resource_mover_service_api.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + **kwargs + ) -> "_models.OperationsDiscoveryCollection": + """get. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationsDiscoveryCollection, or the result of cls(response) + :rtype: ~resource_mover_service_api.models.OperationsDiscoveryCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsDiscoveryCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OperationsDiscoveryCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Migrate/operations'} # type: ignore diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_unresolved_dependencies_operations.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_unresolved_dependencies_operations.py new file mode 100644 index 000000000000..0e40a7ebe99a --- /dev/null +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_unresolved_dependencies_operations.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class UnresolvedDependenciesOperations: + """UnresolvedDependenciesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~resource_mover_service_api.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + move_collection_name: str, + **kwargs + ) -> "_models.UnresolvedDependencyCollection": + """Gets a list of unresolved dependencies. + + :param resource_group_name: The Resource Group Name. + :type resource_group_name: str + :param move_collection_name: The Move Collection Name. + :type move_collection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UnresolvedDependencyCollection, or the result of cls(response) + :rtype: ~resource_mover_service_api.models.UnresolvedDependencyCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UnresolvedDependencyCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('UnresolvedDependencyCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/unresolvedDependencies'} # type: ignore diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/models/__init__.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/models/__init__.py index f11d29625f1b..2d997ef9fea7 100644 --- a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/models/__init__.py +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/models/__init__.py @@ -11,6 +11,7 @@ from ._models_py3 import AutomaticResolutionProperties from ._models_py3 import AvailabilitySetResourceSettings from ._models_py3 import AzureResourceReference + from ._models_py3 import BulkRemoveRequest from ._models_py3 import CloudErrorBody from ._models_py3 import CommitRequest from ._models_py3 import DiscardRequest @@ -38,7 +39,6 @@ from ._models_py3 import MoveResourceProperties from ._models_py3 import MoveResourcePropertiesErrors from ._models_py3 import MoveResourcePropertiesMoveStatus - from ._models_py3 import MoveResourcePropertiesSourceResourceSettings from ._models_py3 import MoveResourceStatus from ._models_py3 import NetworkInterfaceResourceSettings from ._models_py3 import NetworkSecurityGroupResourceSettings @@ -60,6 +60,8 @@ from ._models_py3 import SqlServerResourceSettings from ._models_py3 import SubnetReference from ._models_py3 import SubnetResourceSettings + from ._models_py3 import Summary + from ._models_py3 import SummaryCollection from ._models_py3 import UnresolvedDependency from ._models_py3 import UnresolvedDependencyCollection from ._models_py3 import UpdateMoveCollectionRequest @@ -70,6 +72,7 @@ from ._models import AutomaticResolutionProperties # type: ignore from ._models import AvailabilitySetResourceSettings # type: ignore from ._models import AzureResourceReference # type: ignore + from ._models import BulkRemoveRequest # type: ignore from ._models import CloudErrorBody # type: ignore from ._models import CommitRequest # type: ignore from ._models import DiscardRequest # type: ignore @@ -97,7 +100,6 @@ from ._models import MoveResourceProperties # type: ignore from ._models import MoveResourcePropertiesErrors # type: ignore from ._models import MoveResourcePropertiesMoveStatus # type: ignore - from ._models import MoveResourcePropertiesSourceResourceSettings # type: ignore from ._models import MoveResourceStatus # type: ignore from ._models import NetworkInterfaceResourceSettings # type: ignore from ._models import NetworkSecurityGroupResourceSettings # type: ignore @@ -119,6 +121,8 @@ from ._models import SqlServerResourceSettings # type: ignore from ._models import SubnetReference # type: ignore from ._models import SubnetResourceSettings # type: ignore + from ._models import Summary # type: ignore + from ._models import SummaryCollection # type: ignore from ._models import UnresolvedDependency # type: ignore from ._models import UnresolvedDependencyCollection # type: ignore from ._models import UpdateMoveCollectionRequest # type: ignore @@ -127,6 +131,7 @@ from ._resource_mover_service_api_enums import ( DependencyType, + JobName, MoveResourceInputType, MoveState, ProvisioningState, @@ -141,6 +146,7 @@ 'AutomaticResolutionProperties', 'AvailabilitySetResourceSettings', 'AzureResourceReference', + 'BulkRemoveRequest', 'CloudErrorBody', 'CommitRequest', 'DiscardRequest', @@ -168,7 +174,6 @@ 'MoveResourceProperties', 'MoveResourcePropertiesErrors', 'MoveResourcePropertiesMoveStatus', - 'MoveResourcePropertiesSourceResourceSettings', 'MoveResourceStatus', 'NetworkInterfaceResourceSettings', 'NetworkSecurityGroupResourceSettings', @@ -190,12 +195,15 @@ 'SqlServerResourceSettings', 'SubnetReference', 'SubnetResourceSettings', + 'Summary', + 'SummaryCollection', 'UnresolvedDependency', 'UnresolvedDependencyCollection', 'UpdateMoveCollectionRequest', 'VirtualMachineResourceSettings', 'VirtualNetworkResourceSettings', 'DependencyType', + 'JobName', 'MoveResourceInputType', 'MoveState', 'ProvisioningState', diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/models/_models.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/models/_models.py index edad9e8e4f8b..89c12a186417 100644 --- a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/models/_models.py +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/models/_models.py @@ -68,7 +68,7 @@ class ResourceSettings(msrest.serialization.Model): """Gets or sets the resource settings. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AvailabilitySetResourceSettings, VirtualMachineResourceSettings, LoadBalancerResourceSettings, NetworkInterfaceResourceSettings, NetworkSecurityGroupResourceSettings, PublicIPAddressResourceSettings, VirtualNetworkResourceSettings, SqlServerResourceSettings, SqlDatabaseResourceSettings, SqlElasticPoolResourceSettings, MoveResourcePropertiesSourceResourceSettings, ResourceGroupResourceSettings. + sub-classes are: AvailabilitySetResourceSettings, VirtualMachineResourceSettings, LoadBalancerResourceSettings, NetworkInterfaceResourceSettings, NetworkSecurityGroupResourceSettings, PublicIPAddressResourceSettings, VirtualNetworkResourceSettings, SqlServerResourceSettings, SqlDatabaseResourceSettings, SqlElasticPoolResourceSettings, ResourceGroupResourceSettings. All required parameters must be populated in order to send to Azure. @@ -90,7 +90,7 @@ class ResourceSettings(msrest.serialization.Model): } _subtype_map = { - 'resource_type': {'Microsoft.Compute/availabilitySets': 'AvailabilitySetResourceSettings', 'Microsoft.Compute/virtualMachines': 'VirtualMachineResourceSettings', 'Microsoft.Network/loadBalancers': 'LoadBalancerResourceSettings', 'Microsoft.Network/networkInterfaces': 'NetworkInterfaceResourceSettings', 'Microsoft.Network/networkSecurityGroups': 'NetworkSecurityGroupResourceSettings', 'Microsoft.Network/publicIPAddresses': 'PublicIPAddressResourceSettings', 'Microsoft.Network/virtualNetworks': 'VirtualNetworkResourceSettings', 'Microsoft.Sql/servers': 'SqlServerResourceSettings', 'Microsoft.Sql/servers/databases': 'SqlDatabaseResourceSettings', 'Microsoft.Sql/servers/elasticPools': 'SqlElasticPoolResourceSettings', 'MoveResourceProperties-sourceResourceSettings': 'MoveResourcePropertiesSourceResourceSettings', 'resourceGroups': 'ResourceGroupResourceSettings'} + 'resource_type': {'Microsoft.Compute/availabilitySets': 'AvailabilitySetResourceSettings', 'Microsoft.Compute/virtualMachines': 'VirtualMachineResourceSettings', 'Microsoft.Network/loadBalancers': 'LoadBalancerResourceSettings', 'Microsoft.Network/networkInterfaces': 'NetworkInterfaceResourceSettings', 'Microsoft.Network/networkSecurityGroups': 'NetworkSecurityGroupResourceSettings', 'Microsoft.Network/publicIPAddresses': 'PublicIPAddressResourceSettings', 'Microsoft.Network/virtualNetworks': 'VirtualNetworkResourceSettings', 'Microsoft.Sql/servers': 'SqlServerResourceSettings', 'Microsoft.Sql/servers/databases': 'SqlDatabaseResourceSettings', 'Microsoft.Sql/servers/elasticPools': 'SqlElasticPoolResourceSettings', 'resourceGroups': 'ResourceGroupResourceSettings'} } def __init__( @@ -98,7 +98,7 @@ def __init__( **kwargs ): super(ResourceSettings, self).__init__(**kwargs) - self.resource_type = None + self.resource_type = None # type: Optional[str] self.target_resource_name = kwargs['target_resource_name'] @@ -137,7 +137,7 @@ def __init__( **kwargs ): super(AvailabilitySetResourceSettings, self).__init__(**kwargs) - self.resource_type = 'Microsoft.Compute/availabilitySets' + self.resource_type = 'Microsoft.Compute/availabilitySets' # type: str self.fault_domain = kwargs.get('fault_domain', None) self.update_domain = kwargs.get('update_domain', None) @@ -168,6 +168,36 @@ def __init__( self.source_arm_resource_id = kwargs['source_arm_resource_id'] +class BulkRemoveRequest(msrest.serialization.Model): + """Defines the request body for bulk remove of move resources operation. + + :param validate_only: Gets or sets a value indicating whether the operation needs to only run + pre-requisite. + :type validate_only: bool + :param move_resources: Gets or sets the list of resource Id's, by default it accepts move + resource id's unless the input type is switched via moveResourceInputType property. + :type move_resources: list[str] + :param move_resource_input_type: Defines the move resource input type. Possible values include: + "MoveResourceId", "MoveResourceSourceId". + :type move_resource_input_type: str or ~resource_mover_service_api.models.MoveResourceInputType + """ + + _attribute_map = { + 'validate_only': {'key': 'validateOnly', 'type': 'bool'}, + 'move_resources': {'key': 'moveResources', 'type': '[str]'}, + 'move_resource_input_type': {'key': 'moveResourceInputType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BulkRemoveRequest, self).__init__(**kwargs) + self.validate_only = kwargs.get('validate_only', None) + self.move_resources = kwargs.get('move_resources', None) + self.move_resource_input_type = kwargs.get('move_resource_input_type', None) + + class CloudErrorBody(msrest.serialization.Model): """An error response from the service. @@ -368,14 +398,14 @@ class JobStatus(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar job_name: Defines the job name. Default value: "InitialSync". - :vartype job_name: str + :ivar job_name: Defines the job name. Possible values include: "InitialSync". + :vartype job_name: str or ~resource_mover_service_api.models.JobName :ivar job_progress: Gets or sets the monitoring job percentage. :vartype job_progress: str """ _validation = { - 'job_name': {'readonly': True, 'constant': True}, + 'job_name': {'readonly': True}, 'job_progress': {'readonly': True}, } @@ -384,8 +414,6 @@ class JobStatus(msrest.serialization.Model): 'job_progress': {'key': 'jobProgress', 'type': 'str'}, } - job_name = "InitialSync" - def __init__( self, **kwargs @@ -580,7 +608,7 @@ def __init__( **kwargs ): super(LoadBalancerResourceSettings, self).__init__(**kwargs) - self.resource_type = 'Microsoft.Network/loadBalancers' + self.resource_type = 'Microsoft.Network/loadBalancers' # type: str self.sku = kwargs.get('sku', None) self.frontend_ip_configurations = kwargs.get('frontend_ip_configurations', None) self.backend_address_pools = kwargs.get('backend_address_pools', None) @@ -790,11 +818,15 @@ class MoveResourceCollection(msrest.serialization.Model): :type value: list[~resource_mover_service_api.models.MoveResource] :param next_link: Gets the value of next link. :type next_link: str + :param summary_collection: Gets or sets the list of summary items and the field on which + summary is done. + :type summary_collection: ~resource_mover_service_api.models.SummaryCollection """ _attribute_map = { 'value': {'key': 'value', 'type': '[MoveResource]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'summary_collection': {'key': 'summaryCollection', 'type': 'SummaryCollection'}, } def __init__( @@ -804,6 +836,7 @@ def __init__( super(MoveResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) + self.summary_collection = kwargs.get('summary_collection', None) class MoveResourceDependency(msrest.serialization.Model): @@ -1143,36 +1176,6 @@ def __init__( super(MoveResourcePropertiesMoveStatus, self).__init__(**kwargs) -class MoveResourcePropertiesSourceResourceSettings(ResourceSettings): - """Gets or sets the source resource settings. - - All required parameters must be populated in order to send to Azure. - - :param resource_type: Required. The resource type. For example, the value can be - Microsoft.Compute/virtualMachines.Constant filled by server. - :type resource_type: str - :param target_resource_name: Required. Gets or sets the target Resource name. - :type target_resource_name: str - """ - - _validation = { - 'resource_type': {'required': True}, - 'target_resource_name': {'required': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'target_resource_name': {'key': 'targetResourceName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MoveResourcePropertiesSourceResourceSettings, self).__init__(**kwargs) - self.resource_type = 'MoveResourceProperties-sourceResourceSettings' - - class NetworkInterfaceResourceSettings(ResourceSettings): """Defines the network interface resource settings. @@ -1208,7 +1211,7 @@ def __init__( **kwargs ): super(NetworkInterfaceResourceSettings, self).__init__(**kwargs) - self.resource_type = 'Microsoft.Network/networkInterfaces' + self.resource_type = 'Microsoft.Network/networkInterfaces' # type: str self.ip_configurations = kwargs.get('ip_configurations', None) self.enable_accelerated_networking = kwargs.get('enable_accelerated_networking', None) @@ -1243,7 +1246,7 @@ def __init__( **kwargs ): super(NetworkSecurityGroupResourceSettings, self).__init__(**kwargs) - self.resource_type = 'Microsoft.Network/networkSecurityGroups' + self.resource_type = 'Microsoft.Network/networkSecurityGroups' # type: str self.security_rules = kwargs.get('security_rules', None) @@ -1416,6 +1419,8 @@ class OperationsDiscovery(msrest.serialization.Model): operation (e.g. a localized name for the resource provider + any special considerations like PII release). :type name: str + :param is_data_action: Indicates whether the operation is a data action. + :type is_data_action: bool :param display: Contains the localized display information for this particular operation / action. These value will be used by several clients for @@ -1434,6 +1439,7 @@ class OperationsDiscovery(msrest.serialization.Model): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'Display'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'object'}, @@ -1445,6 +1451,7 @@ def __init__( ): super(OperationsDiscovery, self).__init__(**kwargs) self.name = kwargs.get('name', None) + self.is_data_action = kwargs.get('is_data_action', None) self.display = kwargs.get('display', None) self.origin = kwargs.get('origin', None) self.properties = kwargs.get('properties', None) @@ -1647,7 +1654,7 @@ def __init__( **kwargs ): super(PublicIPAddressResourceSettings, self).__init__(**kwargs) - self.resource_type = 'Microsoft.Network/publicIPAddresses' + self.resource_type = 'Microsoft.Network/publicIPAddresses' # type: str self.domain_name_label = kwargs.get('domain_name_label', None) self.f_qdn = kwargs.get('f_qdn', None) self.public_ip_allocation_method = kwargs.get('public_ip_allocation_method', None) @@ -1682,7 +1689,7 @@ def __init__( **kwargs ): super(ResourceGroupResourceSettings, self).__init__(**kwargs) - self.resource_type = 'resourceGroups' + self.resource_type = 'resourceGroups' # type: str class ResourceMoveRequest(msrest.serialization.Model): @@ -1752,7 +1759,7 @@ def __init__( **kwargs ): super(SqlDatabaseResourceSettings, self).__init__(**kwargs) - self.resource_type = 'Microsoft.Sql/servers/databases' + self.resource_type = 'Microsoft.Sql/servers/databases' # type: str self.zone_redundant = kwargs.get('zone_redundant', None) @@ -1787,7 +1794,7 @@ def __init__( **kwargs ): super(SqlElasticPoolResourceSettings, self).__init__(**kwargs) - self.resource_type = 'Microsoft.Sql/servers/elasticPools' + self.resource_type = 'Microsoft.Sql/servers/elasticPools' # type: str self.zone_redundant = kwargs.get('zone_redundant', None) @@ -1818,7 +1825,7 @@ def __init__( **kwargs ): super(SqlServerResourceSettings, self).__init__(**kwargs) - self.resource_type = 'Microsoft.Sql/servers' + self.resource_type = 'Microsoft.Sql/servers' # type: str class SubnetReference(ProxyResourceReference): @@ -1872,6 +1879,52 @@ def __init__( self.address_prefix = kwargs.get('address_prefix', None) +class Summary(msrest.serialization.Model): + """Summary item. + + :param count: Gets the count. + :type count: int + :param item: Gets the item. + :type item: str + """ + + _attribute_map = { + 'count': {'key': 'count', 'type': 'int'}, + 'item': {'key': 'item', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Summary, self).__init__(**kwargs) + self.count = kwargs.get('count', None) + self.item = kwargs.get('item', None) + + +class SummaryCollection(msrest.serialization.Model): + """Summary Collection. + + :param field_name: Gets or sets the field name on which summary is done. + :type field_name: str + :param summary: Gets or sets the list of summary items. + :type summary: list[~resource_mover_service_api.models.Summary] + """ + + _attribute_map = { + 'field_name': {'key': 'fieldName', 'type': 'str'}, + 'summary': {'key': 'summary', 'type': '[Summary]'}, + } + + def __init__( + self, + **kwargs + ): + super(SummaryCollection, self).__init__(**kwargs) + self.field_name = kwargs.get('field_name', None) + self.summary = kwargs.get('summary', None) + + class UnresolvedDependency(msrest.serialization.Model): """Unresolved dependency. @@ -1980,7 +2033,7 @@ def __init__( **kwargs ): super(VirtualMachineResourceSettings, self).__init__(**kwargs) - self.resource_type = 'Microsoft.Compute/virtualMachines' + self.resource_type = 'Microsoft.Compute/virtualMachines' # type: str self.target_availability_zone = kwargs.get('target_availability_zone', None) self.target_vm_size = kwargs.get('target_vm_size', None) self.target_availability_set_id = kwargs.get('target_availability_set_id', None) @@ -2028,7 +2081,7 @@ def __init__( **kwargs ): super(VirtualNetworkResourceSettings, self).__init__(**kwargs) - self.resource_type = 'Microsoft.Network/virtualNetworks' + self.resource_type = 'Microsoft.Network/virtualNetworks' # type: str self.enable_ddos_protection = kwargs.get('enable_ddos_protection', None) self.address_space = kwargs.get('address_space', None) self.dns_servers = kwargs.get('dns_servers', None) diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/models/_models_py3.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/models/_models_py3.py index 5b274ca100a3..8d6a2b0fbbbc 100644 --- a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/models/_models_py3.py +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/models/_models_py3.py @@ -74,7 +74,7 @@ class ResourceSettings(msrest.serialization.Model): """Gets or sets the resource settings. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AvailabilitySetResourceSettings, VirtualMachineResourceSettings, LoadBalancerResourceSettings, NetworkInterfaceResourceSettings, NetworkSecurityGroupResourceSettings, PublicIPAddressResourceSettings, VirtualNetworkResourceSettings, SqlServerResourceSettings, SqlDatabaseResourceSettings, SqlElasticPoolResourceSettings, MoveResourcePropertiesSourceResourceSettings, ResourceGroupResourceSettings. + sub-classes are: AvailabilitySetResourceSettings, VirtualMachineResourceSettings, LoadBalancerResourceSettings, NetworkInterfaceResourceSettings, NetworkSecurityGroupResourceSettings, PublicIPAddressResourceSettings, VirtualNetworkResourceSettings, SqlServerResourceSettings, SqlDatabaseResourceSettings, SqlElasticPoolResourceSettings, ResourceGroupResourceSettings. All required parameters must be populated in order to send to Azure. @@ -96,7 +96,7 @@ class ResourceSettings(msrest.serialization.Model): } _subtype_map = { - 'resource_type': {'Microsoft.Compute/availabilitySets': 'AvailabilitySetResourceSettings', 'Microsoft.Compute/virtualMachines': 'VirtualMachineResourceSettings', 'Microsoft.Network/loadBalancers': 'LoadBalancerResourceSettings', 'Microsoft.Network/networkInterfaces': 'NetworkInterfaceResourceSettings', 'Microsoft.Network/networkSecurityGroups': 'NetworkSecurityGroupResourceSettings', 'Microsoft.Network/publicIPAddresses': 'PublicIPAddressResourceSettings', 'Microsoft.Network/virtualNetworks': 'VirtualNetworkResourceSettings', 'Microsoft.Sql/servers': 'SqlServerResourceSettings', 'Microsoft.Sql/servers/databases': 'SqlDatabaseResourceSettings', 'Microsoft.Sql/servers/elasticPools': 'SqlElasticPoolResourceSettings', 'MoveResourceProperties-sourceResourceSettings': 'MoveResourcePropertiesSourceResourceSettings', 'resourceGroups': 'ResourceGroupResourceSettings'} + 'resource_type': {'Microsoft.Compute/availabilitySets': 'AvailabilitySetResourceSettings', 'Microsoft.Compute/virtualMachines': 'VirtualMachineResourceSettings', 'Microsoft.Network/loadBalancers': 'LoadBalancerResourceSettings', 'Microsoft.Network/networkInterfaces': 'NetworkInterfaceResourceSettings', 'Microsoft.Network/networkSecurityGroups': 'NetworkSecurityGroupResourceSettings', 'Microsoft.Network/publicIPAddresses': 'PublicIPAddressResourceSettings', 'Microsoft.Network/virtualNetworks': 'VirtualNetworkResourceSettings', 'Microsoft.Sql/servers': 'SqlServerResourceSettings', 'Microsoft.Sql/servers/databases': 'SqlDatabaseResourceSettings', 'Microsoft.Sql/servers/elasticPools': 'SqlElasticPoolResourceSettings', 'resourceGroups': 'ResourceGroupResourceSettings'} } def __init__( @@ -106,7 +106,7 @@ def __init__( **kwargs ): super(ResourceSettings, self).__init__(**kwargs) - self.resource_type: Optional[str] = None + self.resource_type = None # type: Optional[str] self.target_resource_name = target_resource_name @@ -149,7 +149,7 @@ def __init__( **kwargs ): super(AvailabilitySetResourceSettings, self).__init__(target_resource_name=target_resource_name, **kwargs) - self.resource_type: str = 'Microsoft.Compute/availabilitySets' + self.resource_type = 'Microsoft.Compute/availabilitySets' # type: str self.fault_domain = fault_domain self.update_domain = update_domain @@ -182,6 +182,40 @@ def __init__( self.source_arm_resource_id = source_arm_resource_id +class BulkRemoveRequest(msrest.serialization.Model): + """Defines the request body for bulk remove of move resources operation. + + :param validate_only: Gets or sets a value indicating whether the operation needs to only run + pre-requisite. + :type validate_only: bool + :param move_resources: Gets or sets the list of resource Id's, by default it accepts move + resource id's unless the input type is switched via moveResourceInputType property. + :type move_resources: list[str] + :param move_resource_input_type: Defines the move resource input type. Possible values include: + "MoveResourceId", "MoveResourceSourceId". + :type move_resource_input_type: str or ~resource_mover_service_api.models.MoveResourceInputType + """ + + _attribute_map = { + 'validate_only': {'key': 'validateOnly', 'type': 'bool'}, + 'move_resources': {'key': 'moveResources', 'type': '[str]'}, + 'move_resource_input_type': {'key': 'moveResourceInputType', 'type': 'str'}, + } + + def __init__( + self, + *, + validate_only: Optional[bool] = None, + move_resources: Optional[List[str]] = None, + move_resource_input_type: Optional[Union[str, "MoveResourceInputType"]] = None, + **kwargs + ): + super(BulkRemoveRequest, self).__init__(**kwargs) + self.validate_only = validate_only + self.move_resources = move_resources + self.move_resource_input_type = move_resource_input_type + + class CloudErrorBody(msrest.serialization.Model): """An error response from the service. @@ -404,14 +438,14 @@ class JobStatus(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar job_name: Defines the job name. Default value: "InitialSync". - :vartype job_name: str + :ivar job_name: Defines the job name. Possible values include: "InitialSync". + :vartype job_name: str or ~resource_mover_service_api.models.JobName :ivar job_progress: Gets or sets the monitoring job percentage. :vartype job_progress: str """ _validation = { - 'job_name': {'readonly': True, 'constant': True}, + 'job_name': {'readonly': True}, 'job_progress': {'readonly': True}, } @@ -420,8 +454,6 @@ class JobStatus(msrest.serialization.Model): 'job_progress': {'key': 'jobProgress', 'type': 'str'}, } - job_name = "InitialSync" - def __init__( self, **kwargs @@ -639,7 +671,7 @@ def __init__( **kwargs ): super(LoadBalancerResourceSettings, self).__init__(target_resource_name=target_resource_name, **kwargs) - self.resource_type: str = 'Microsoft.Network/loadBalancers' + self.resource_type = 'Microsoft.Network/loadBalancers' # type: str self.sku = sku self.frontend_ip_configurations = frontend_ip_configurations self.backend_address_pools = backend_address_pools @@ -864,11 +896,15 @@ class MoveResourceCollection(msrest.serialization.Model): :type value: list[~resource_mover_service_api.models.MoveResource] :param next_link: Gets the value of next link. :type next_link: str + :param summary_collection: Gets or sets the list of summary items and the field on which + summary is done. + :type summary_collection: ~resource_mover_service_api.models.SummaryCollection """ _attribute_map = { 'value': {'key': 'value', 'type': '[MoveResource]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'summary_collection': {'key': 'summaryCollection', 'type': 'SummaryCollection'}, } def __init__( @@ -876,11 +912,13 @@ def __init__( *, value: Optional[List["MoveResource"]] = None, next_link: Optional[str] = None, + summary_collection: Optional["SummaryCollection"] = None, **kwargs ): super(MoveResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link + self.summary_collection = summary_collection class MoveResourceDependency(msrest.serialization.Model): @@ -1250,38 +1288,6 @@ def __init__( super(MoveResourcePropertiesMoveStatus, self).__init__(job_status=job_status, errors=errors, **kwargs) -class MoveResourcePropertiesSourceResourceSettings(ResourceSettings): - """Gets or sets the source resource settings. - - All required parameters must be populated in order to send to Azure. - - :param resource_type: Required. The resource type. For example, the value can be - Microsoft.Compute/virtualMachines.Constant filled by server. - :type resource_type: str - :param target_resource_name: Required. Gets or sets the target Resource name. - :type target_resource_name: str - """ - - _validation = { - 'resource_type': {'required': True}, - 'target_resource_name': {'required': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'target_resource_name': {'key': 'targetResourceName', 'type': 'str'}, - } - - def __init__( - self, - *, - target_resource_name: str, - **kwargs - ): - super(MoveResourcePropertiesSourceResourceSettings, self).__init__(target_resource_name=target_resource_name, **kwargs) - self.resource_type: str = 'MoveResourceProperties-sourceResourceSettings' - - class NetworkInterfaceResourceSettings(ResourceSettings): """Defines the network interface resource settings. @@ -1321,7 +1327,7 @@ def __init__( **kwargs ): super(NetworkInterfaceResourceSettings, self).__init__(target_resource_name=target_resource_name, **kwargs) - self.resource_type: str = 'Microsoft.Network/networkInterfaces' + self.resource_type = 'Microsoft.Network/networkInterfaces' # type: str self.ip_configurations = ip_configurations self.enable_accelerated_networking = enable_accelerated_networking @@ -1359,7 +1365,7 @@ def __init__( **kwargs ): super(NetworkSecurityGroupResourceSettings, self).__init__(target_resource_name=target_resource_name, **kwargs) - self.resource_type: str = 'Microsoft.Network/networkSecurityGroups' + self.resource_type = 'Microsoft.Network/networkSecurityGroups' # type: str self.security_rules = security_rules @@ -1550,6 +1556,8 @@ class OperationsDiscovery(msrest.serialization.Model): operation (e.g. a localized name for the resource provider + any special considerations like PII release). :type name: str + :param is_data_action: Indicates whether the operation is a data action. + :type is_data_action: bool :param display: Contains the localized display information for this particular operation / action. These value will be used by several clients for @@ -1568,6 +1576,7 @@ class OperationsDiscovery(msrest.serialization.Model): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'Display'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'object'}, @@ -1577,6 +1586,7 @@ def __init__( self, *, name: Optional[str] = None, + is_data_action: Optional[bool] = None, display: Optional["Display"] = None, origin: Optional[str] = None, properties: Optional[object] = None, @@ -1584,6 +1594,7 @@ def __init__( ): super(OperationsDiscovery, self).__init__(**kwargs) self.name = name + self.is_data_action = is_data_action self.display = display self.origin = origin self.properties = properties @@ -1800,7 +1811,7 @@ def __init__( **kwargs ): super(PublicIPAddressResourceSettings, self).__init__(target_resource_name=target_resource_name, **kwargs) - self.resource_type: str = 'Microsoft.Network/publicIPAddresses' + self.resource_type = 'Microsoft.Network/publicIPAddresses' # type: str self.domain_name_label = domain_name_label self.f_qdn = f_qdn self.public_ip_allocation_method = public_ip_allocation_method @@ -1837,7 +1848,7 @@ def __init__( **kwargs ): super(ResourceGroupResourceSettings, self).__init__(target_resource_name=target_resource_name, **kwargs) - self.resource_type: str = 'resourceGroups' + self.resource_type = 'resourceGroups' # type: str class ResourceMoveRequest(msrest.serialization.Model): @@ -1914,7 +1925,7 @@ def __init__( **kwargs ): super(SqlDatabaseResourceSettings, self).__init__(target_resource_name=target_resource_name, **kwargs) - self.resource_type: str = 'Microsoft.Sql/servers/databases' + self.resource_type = 'Microsoft.Sql/servers/databases' # type: str self.zone_redundant = zone_redundant @@ -1952,7 +1963,7 @@ def __init__( **kwargs ): super(SqlElasticPoolResourceSettings, self).__init__(target_resource_name=target_resource_name, **kwargs) - self.resource_type: str = 'Microsoft.Sql/servers/elasticPools' + self.resource_type = 'Microsoft.Sql/servers/elasticPools' # type: str self.zone_redundant = zone_redundant @@ -1985,7 +1996,7 @@ def __init__( **kwargs ): super(SqlServerResourceSettings, self).__init__(target_resource_name=target_resource_name, **kwargs) - self.resource_type: str = 'Microsoft.Sql/servers' + self.resource_type = 'Microsoft.Sql/servers' # type: str class SubnetReference(ProxyResourceReference): @@ -2045,6 +2056,58 @@ def __init__( self.address_prefix = address_prefix +class Summary(msrest.serialization.Model): + """Summary item. + + :param count: Gets the count. + :type count: int + :param item: Gets the item. + :type item: str + """ + + _attribute_map = { + 'count': {'key': 'count', 'type': 'int'}, + 'item': {'key': 'item', 'type': 'str'}, + } + + def __init__( + self, + *, + count: Optional[int] = None, + item: Optional[str] = None, + **kwargs + ): + super(Summary, self).__init__(**kwargs) + self.count = count + self.item = item + + +class SummaryCollection(msrest.serialization.Model): + """Summary Collection. + + :param field_name: Gets or sets the field name on which summary is done. + :type field_name: str + :param summary: Gets or sets the list of summary items. + :type summary: list[~resource_mover_service_api.models.Summary] + """ + + _attribute_map = { + 'field_name': {'key': 'fieldName', 'type': 'str'}, + 'summary': {'key': 'summary', 'type': '[Summary]'}, + } + + def __init__( + self, + *, + field_name: Optional[str] = None, + summary: Optional[List["Summary"]] = None, + **kwargs + ): + super(SummaryCollection, self).__init__(**kwargs) + self.field_name = field_name + self.summary = summary + + class UnresolvedDependency(msrest.serialization.Model): """Unresolved dependency. @@ -2167,7 +2230,7 @@ def __init__( **kwargs ): super(VirtualMachineResourceSettings, self).__init__(target_resource_name=target_resource_name, **kwargs) - self.resource_type: str = 'Microsoft.Compute/virtualMachines' + self.resource_type = 'Microsoft.Compute/virtualMachines' # type: str self.target_availability_zone = target_availability_zone self.target_vm_size = target_vm_size self.target_availability_set_id = target_availability_set_id @@ -2221,7 +2284,7 @@ def __init__( **kwargs ): super(VirtualNetworkResourceSettings, self).__init__(target_resource_name=target_resource_name, **kwargs) - self.resource_type: str = 'Microsoft.Network/virtualNetworks' + self.resource_type = 'Microsoft.Network/virtualNetworks' # type: str self.enable_ddos_protection = enable_ddos_protection self.address_space = address_space self.dns_servers = dns_servers diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/models/_resource_mover_service_api_enums.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/models/_resource_mover_service_api_enums.py index 51532630f9d8..d283cae8590a 100644 --- a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/models/_resource_mover_service_api_enums.py +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/models/_resource_mover_service_api_enums.py @@ -6,76 +6,100 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum - -class DependencyType(str, Enum): +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class DependencyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Defines the dependency type. """ - required_for_prepare = "RequiredForPrepare" - required_for_move = "RequiredForMove" + REQUIRED_FOR_PREPARE = "RequiredForPrepare" + REQUIRED_FOR_MOVE = "RequiredForMove" + +class JobName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Defines the job name. + """ + + INITIAL_SYNC = "InitialSync" -class MoveResourceInputType(str, Enum): +class MoveResourceInputType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Defines the move resource input type. """ - move_resource_id = "MoveResourceId" - move_resource_source_id = "MoveResourceSourceId" + MOVE_RESOURCE_ID = "MoveResourceId" + MOVE_RESOURCE_SOURCE_ID = "MoveResourceSourceId" -class MoveState(str, Enum): +class MoveState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Defines the MoveResource states. """ - assignment_pending = "AssignmentPending" - prepare_pending = "PreparePending" - prepare_in_progress = "PrepareInProgress" - prepare_failed = "PrepareFailed" - move_pending = "MovePending" - move_in_progress = "MoveInProgress" - move_failed = "MoveFailed" - discard_in_progress = "DiscardInProgress" - discard_failed = "DiscardFailed" - commit_pending = "CommitPending" - commit_in_progress = "CommitInProgress" - commit_failed = "CommitFailed" - committed = "Committed" - -class ProvisioningState(str, Enum): + ASSIGNMENT_PENDING = "AssignmentPending" + PREPARE_PENDING = "PreparePending" + PREPARE_IN_PROGRESS = "PrepareInProgress" + PREPARE_FAILED = "PrepareFailed" + MOVE_PENDING = "MovePending" + MOVE_IN_PROGRESS = "MoveInProgress" + MOVE_FAILED = "MoveFailed" + DISCARD_IN_PROGRESS = "DiscardInProgress" + DISCARD_FAILED = "DiscardFailed" + COMMIT_PENDING = "CommitPending" + COMMIT_IN_PROGRESS = "CommitInProgress" + COMMIT_FAILED = "CommitFailed" + COMMITTED = "Committed" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Defines the provisioning states. """ - succeeded = "Succeeded" - updating = "Updating" - creating = "Creating" - failed = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + CREATING = "Creating" + FAILED = "Failed" -class ResolutionType(str, Enum): +class ResolutionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Defines the resolution type. """ - manual = "Manual" - automatic = "Automatic" + MANUAL = "Manual" + AUTOMATIC = "Automatic" -class ResourceIdentityType(str, Enum): +class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The type of identity used for the resource mover service. """ - none = "None" - system_assigned = "SystemAssigned" - user_assigned = "UserAssigned" + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" -class TargetAvailabilityZone(str, Enum): +class TargetAvailabilityZone(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the target availability zone. """ - one = "1" - two = "2" - three = "3" - na = "NA" + ONE = "1" + TWO = "2" + THREE = "3" + NA = "NA" -class ZoneRedundant(str, Enum): +class ZoneRedundant(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Defines the zone redundant resource setting. """ - enable = "Enable" - disable = "Disable" + ENABLE = "Enable" + DISABLE = "Disable" diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/operations/_move_collections_operations.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/operations/_move_collections_operations.py index 4ac913c942c8..79f2338b1cd3 100644 --- a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/operations/_move_collections_operations.py +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/operations/_move_collections_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class MoveCollectionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,10 +51,10 @@ def create( self, resource_group_name, # type: str move_collection_name, # type: str - body=None, # type: Optional["models.MoveCollection"] + body=None, # type: Optional["_models.MoveCollection"] **kwargs # type: Any ): - # type: (...) -> "models.MoveCollection" + # type: (...) -> "_models.MoveCollection" """Creates or updates a move collection. :param resource_group_name: The Resource Group Name. @@ -68,11 +68,14 @@ def create( :rtype: ~resource_mover_service_api.models.MoveCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MoveCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + cls = kwargs.pop('cls', None) # type: ClsType["_models.MoveCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create.metadata['url'] # type: ignore @@ -90,7 +93,7 @@ def create( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] if body is not None: @@ -99,7 +102,6 @@ def create( body_content = None 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 @@ -123,10 +125,10 @@ def update( self, resource_group_name, # type: str move_collection_name, # type: str - body=None, # type: Optional["models.UpdateMoveCollectionRequest"] + body=None, # type: Optional["_models.UpdateMoveCollectionRequest"] **kwargs # type: Any ): - # type: (...) -> "models.MoveCollection" + # type: (...) -> "_models.MoveCollection" """Updates a move collection. :param resource_group_name: The Resource Group Name. @@ -140,11 +142,14 @@ def update( :rtype: ~resource_mover_service_api.models.MoveCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MoveCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + cls = kwargs.pop('cls', None) # type: ClsType["_models.MoveCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -162,7 +167,7 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] if body is not None: @@ -171,7 +176,6 @@ def update( body_content = None 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 @@ -193,11 +197,14 @@ def _delete_initial( move_collection_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.OperationStatus"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.OperationStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + # type: (...) -> Optional["_models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatus"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01-preview" + accept = "application/json" # Construct URL url = self._delete_initial.metadata['url'] # type: ignore @@ -214,7 +221,7 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -240,7 +247,7 @@ def begin_delete( move_collection_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.OperationStatus"] + # type: (...) -> LROPoller["_models.OperationStatus"] """Deletes a move collection. :param resource_group_name: The Resource Group Name. @@ -258,7 +265,7 @@ def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -282,7 +289,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -302,7 +315,7 @@ def get( move_collection_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.MoveCollection" + # type: (...) -> "_models.MoveCollection" """Gets the move collection. :param resource_group_name: The Resource Group Name. @@ -314,10 +327,13 @@ def get( :rtype: ~resource_mover_service_api.models.MoveCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MoveCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + cls = kwargs.pop('cls', None) # type: ClsType["_models.MoveCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01-preview" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -334,7 +350,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -356,15 +372,18 @@ def _prepare_initial( self, resource_group_name, # type: str move_collection_name, # type: str - body=None, # type: Optional["models.PrepareRequest"] + body=None, # type: Optional["_models.PrepareRequest"] **kwargs # type: Any ): - # type: (...) -> Optional["models.OperationStatus"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.OperationStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + # type: (...) -> Optional["_models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatus"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._prepare_initial.metadata['url'] # type: ignore @@ -382,7 +401,7 @@ def _prepare_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] if body is not None: @@ -391,7 +410,6 @@ def _prepare_initial( body_content = None body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,15 +431,15 @@ def begin_prepare( self, resource_group_name, # type: str move_collection_name, # type: str - body=None, # type: Optional["models.PrepareRequest"] + body=None, # type: Optional["_models.PrepareRequest"] **kwargs # type: Any ): - # type: (...) -> LROPoller["models.OperationStatus"] + # type: (...) -> LROPoller["_models.OperationStatus"] """Initiates prepare for the set of resources included in the request body. The prepare operation - is on the moveResources that are in the moveState 'PreparePending' or 'PrepareFailed', on a - successful completion the moveResource moveState do a transition to MovePending. To aid the - user to prerequisite the operation the client can call operation with validateOnly property set - to true. + is on the moveResources that are in the moveState 'PreparePending' or 'PrepareFailed', on a + successful completion the moveResource moveState do a transition to MovePending. To aid the + user to prerequisite the operation the client can call operation with validateOnly property set + to true. :param resource_group_name: The Resource Group Name. :type resource_group_name: str @@ -440,7 +458,7 @@ def begin_prepare( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -465,7 +483,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -483,15 +507,18 @@ def _initiate_move_initial( self, resource_group_name, # type: str move_collection_name, # type: str - body=None, # type: Optional["models.ResourceMoveRequest"] + body=None, # type: Optional["_models.ResourceMoveRequest"] **kwargs # type: Any ): - # type: (...) -> Optional["models.OperationStatus"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.OperationStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + # type: (...) -> Optional["_models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatus"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._initiate_move_initial.metadata['url'] # type: ignore @@ -509,7 +536,7 @@ def _initiate_move_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] if body is not None: @@ -518,7 +545,6 @@ def _initiate_move_initial( body_content = None body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -540,15 +566,15 @@ def begin_initiate_move( self, resource_group_name, # type: str move_collection_name, # type: str - body=None, # type: Optional["models.ResourceMoveRequest"] + body=None, # type: Optional["_models.ResourceMoveRequest"] **kwargs # type: Any ): - # type: (...) -> LROPoller["models.OperationStatus"] + # type: (...) -> LROPoller["_models.OperationStatus"] """Moves the set of resources included in the request body. The move operation is triggered after - the moveResources are in the moveState 'MovePending' or 'MoveFailed', on a successful - completion the moveResource moveState do a transition to CommitPending. To aid the user to - prerequisite the operation the client can call operation with validateOnly property set to - true. + the moveResources are in the moveState 'MovePending' or 'MoveFailed', on a successful + completion the moveResource moveState do a transition to CommitPending. To aid the user to + prerequisite the operation the client can call operation with validateOnly property set to + true. :param resource_group_name: The Resource Group Name. :type resource_group_name: str @@ -567,7 +593,7 @@ def begin_initiate_move( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -592,7 +618,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -610,15 +642,18 @@ def _commit_initial( self, resource_group_name, # type: str move_collection_name, # type: str - body=None, # type: Optional["models.CommitRequest"] + body=None, # type: Optional["_models.CommitRequest"] **kwargs # type: Any ): - # type: (...) -> Optional["models.OperationStatus"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.OperationStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + # type: (...) -> Optional["_models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatus"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._commit_initial.metadata['url'] # type: ignore @@ -636,7 +671,7 @@ def _commit_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] if body is not None: @@ -645,7 +680,6 @@ def _commit_initial( body_content = None body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -667,15 +701,15 @@ def begin_commit( self, resource_group_name, # type: str move_collection_name, # type: str - body=None, # type: Optional["models.CommitRequest"] + body=None, # type: Optional["_models.CommitRequest"] **kwargs # type: Any ): - # type: (...) -> LROPoller["models.OperationStatus"] + # type: (...) -> LROPoller["_models.OperationStatus"] """Commits the set of resources included in the request body. The commit operation is triggered on - the moveResources in the moveState 'CommitPending' or 'CommitFailed', on a successful - completion the moveResource moveState do a transition to Committed. To aid the user to - prerequisite the operation the client can call operation with validateOnly property set to - true. + the moveResources in the moveState 'CommitPending' or 'CommitFailed', on a successful + completion the moveResource moveState do a transition to Committed. To aid the user to + prerequisite the operation the client can call operation with validateOnly property set to + true. :param resource_group_name: The Resource Group Name. :type resource_group_name: str @@ -694,7 +728,7 @@ def begin_commit( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -719,7 +753,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -737,15 +777,18 @@ def _discard_initial( self, resource_group_name, # type: str move_collection_name, # type: str - body=None, # type: Optional["models.DiscardRequest"] + body=None, # type: Optional["_models.DiscardRequest"] **kwargs # type: Any ): - # type: (...) -> Optional["models.OperationStatus"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.OperationStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + # type: (...) -> Optional["_models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatus"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._discard_initial.metadata['url'] # type: ignore @@ -763,7 +806,7 @@ def _discard_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] if body is not None: @@ -772,7 +815,6 @@ def _discard_initial( body_content = None body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,15 +836,15 @@ def begin_discard( self, resource_group_name, # type: str move_collection_name, # type: str - body=None, # type: Optional["models.DiscardRequest"] + body=None, # type: Optional["_models.DiscardRequest"] **kwargs # type: Any ): - # type: (...) -> LROPoller["models.OperationStatus"] + # type: (...) -> LROPoller["_models.OperationStatus"] """Discards the set of resources included in the request body. The discard operation is triggered - on the moveResources in the moveState 'CommitPending' or 'DiscardFailed', on a successful - completion the moveResource moveState do a transition to MovePending. To aid the user to - prerequisite the operation the client can call operation with validateOnly property set to - true. + on the moveResources in the moveState 'CommitPending' or 'DiscardFailed', on a successful + completion the moveResource moveState do a transition to MovePending. To aid the user to + prerequisite the operation the client can call operation with validateOnly property set to + true. :param resource_group_name: The Resource Group Name. :type resource_group_name: str @@ -821,7 +863,7 @@ def begin_discard( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -846,7 +888,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -866,11 +914,14 @@ def _resolve_dependencies_initial( move_collection_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.OperationStatus"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.OperationStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + # type: (...) -> Optional["_models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatus"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01-preview" + accept = "application/json" # Construct URL url = self._resolve_dependencies_initial.metadata['url'] # type: ignore @@ -887,7 +938,7 @@ def _resolve_dependencies_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -913,7 +964,7 @@ def begin_resolve_dependencies( move_collection_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.OperationStatus"] + # type: (...) -> LROPoller["_models.OperationStatus"] """Computes, resolves and validate the dependencies of the moveResources in the move collection. :param resource_group_name: The Resource Group Name. @@ -931,7 +982,7 @@ def begin_resolve_dependencies( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -955,7 +1006,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -969,11 +1026,144 @@ def get_long_running_output(pipeline_response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_resolve_dependencies.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/resolveDependencies'} # type: ignore + def _bulk_remove_initial( + self, + resource_group_name, # type: str + move_collection_name, # type: str + body=None, # type: Optional["_models.BulkRemoveRequest"] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatus"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._bulk_remove_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'BulkRemoveRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _bulk_remove_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/bulkRemove'} # type: ignore + + def begin_bulk_remove( + self, + resource_group_name, # type: str + move_collection_name, # type: str + body=None, # type: Optional["_models.BulkRemoveRequest"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.OperationStatus"] + """Removes the set of move resources included in the request body from move collection. The + orchestration is done by service. To aid the user to prerequisite the operation the client can + call operation with validateOnly property set to true. + + :param resource_group_name: + :type resource_group_name: str + :param move_collection_name: + :type move_collection_name: str + :param body: + :type body: ~resource_mover_service_api.models.BulkRemoveRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatus or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~resource_mover_service_api.models.OperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._bulk_remove_initial( + resource_group_name=resource_group_name, + move_collection_name=move_collection_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_bulk_remove.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/bulkRemove'} # type: ignore + def list_move_collections_by_subscription( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.MoveCollectionResultList"] + # type: (...) -> Iterable["_models.MoveCollectionResultList"] """Get all Move Collections. Get all the Move Collections in the subscription. @@ -983,15 +1173,18 @@ def list_move_collections_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~resource_mover_service_api.models.MoveCollectionResultList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MoveCollectionResultList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + cls = kwargs.pop('cls', None) # type: ClsType["_models.MoveCollectionResultList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01-preview" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -1040,7 +1233,7 @@ def list_move_collections_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.MoveCollectionResultList"] + # type: (...) -> Iterable["_models.MoveCollectionResultList"] """Get all Move Collections. Get all the Move Collections in the resource group. @@ -1052,15 +1245,18 @@ def list_move_collections_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~resource_mover_service_api.models.MoveCollectionResultList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MoveCollectionResultList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + cls = kwargs.pop('cls', None) # type: ClsType["_models.MoveCollectionResultList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01-preview" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/operations/_move_resources_operations.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/operations/_move_resources_operations.py index df788568ba54..3c3e925fe979 100644 --- a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/operations/_move_resources_operations.py +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/operations/_move_resources_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class MoveResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -54,7 +54,7 @@ def list( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.MoveResourceCollection"] + # type: (...) -> Iterable["_models.MoveResourceCollection"] """Lists the Move Resources in the move collection. :param resource_group_name: The Resource Group Name. @@ -62,22 +62,25 @@ def list( :param move_collection_name: The Move Collection Name. :type move_collection_name: str :param filter: The filter to apply on the operation. For example, you can use - $filter=Properties/ProvisioningState eq 'Succeeded'. + $filter=Properties/ProvisioningState eq 'Succeeded'. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MoveResourceCollection or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~resource_mover_service_api.models.MoveResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MoveResourceCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + cls = kwargs.pop('cls', None) # type: ClsType["_models.MoveResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01-preview" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -130,15 +133,18 @@ def _create_initial( resource_group_name, # type: str move_collection_name, # type: str move_resource_name, # type: str - body=None, # type: Optional["models.MoveResource"] + body=None, # type: Optional["_models.MoveResource"] **kwargs # type: Any ): - # type: (...) -> Optional["models.MoveResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MoveResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + # type: (...) -> Optional["_models.MoveResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MoveResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_initial.metadata['url'] # type: ignore @@ -157,7 +163,7 @@ def _create_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] if body is not None: @@ -166,7 +172,6 @@ def _create_initial( body_content = None 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 @@ -189,10 +194,10 @@ def begin_create( resource_group_name, # type: str move_collection_name, # type: str move_resource_name, # type: str - body=None, # type: Optional["models.MoveResource"] + body=None, # type: Optional["_models.MoveResource"] **kwargs # type: Any ): - # type: (...) -> LROPoller["models.MoveResource"] + # type: (...) -> LROPoller["_models.MoveResource"] """Creates or updates a Move Resource in the move collection. :param resource_group_name: The Resource Group Name. @@ -214,7 +219,7 @@ def begin_create( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.MoveResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MoveResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -240,7 +245,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + 'moveResourceName': self._serialize.url("move_resource_name", move_resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -261,11 +273,14 @@ def _delete_initial( move_resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.OperationStatus"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.OperationStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + # type: (...) -> Optional["_models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatus"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01-preview" + accept = "application/json" # Construct URL url = self._delete_initial.metadata['url'] # type: ignore @@ -283,7 +298,7 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -310,7 +325,7 @@ def begin_delete( move_resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.OperationStatus"] + # type: (...) -> LROPoller["_models.OperationStatus"] """Deletes a Move Resource from the move collection. :param resource_group_name: The Resource Group Name. @@ -330,7 +345,7 @@ def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -355,7 +370,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'moveCollectionName': self._serialize.url("move_collection_name", move_collection_name, 'str'), + 'moveResourceName': self._serialize.url("move_resource_name", move_resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -376,7 +398,7 @@ def get( move_resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.MoveResource" + # type: (...) -> "_models.MoveResource" """Gets the Move Resource. :param resource_group_name: The Resource Group Name. @@ -390,10 +412,13 @@ def get( :rtype: ~resource_mover_service_api.models.MoveResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MoveResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + cls = kwargs.pop('cls', None) # type: ClsType["_models.MoveResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01-preview" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -411,7 +436,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/operations/_operations_discovery_operations.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/operations/_operations_discovery_operations.py index 3a0e1c49c868..dfe92e8cf1ad 100644 --- a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/operations/_operations_discovery_operations.py +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/operations/_operations_discovery_operations.py @@ -8,12 +8,12 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class OperationsDiscoveryOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,7 +48,7 @@ def get( self, **kwargs # type: Any ): - # type: (...) -> "models.OperationsDiscoveryCollection" + # type: (...) -> "_models.OperationsDiscoveryCollection" """get. :keyword callable cls: A custom type or function that will be passed the direct response @@ -56,10 +56,13 @@ def get( :rtype: ~resource_mover_service_api.models.OperationsDiscoveryCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationsDiscoveryCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsDiscoveryCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01-preview" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -70,7 +73,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/operations/_unresolved_dependencies_operations.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/operations/_unresolved_dependencies_operations.py index 3ab01138bfe2..17b19853e56d 100644 --- a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/operations/_unresolved_dependencies_operations.py +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/operations/_unresolved_dependencies_operations.py @@ -8,12 +8,12 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class UnresolvedDependenciesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def get( move_collection_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.UnresolvedDependencyCollection" + # type: (...) -> "_models.UnresolvedDependencyCollection" """Gets a list of unresolved dependencies. :param resource_group_name: The Resource Group Name. @@ -62,10 +62,13 @@ def get( :rtype: ~resource_mover_service_api.models.UnresolvedDependencyCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.UnresolvedDependencyCollection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + cls = kwargs.pop('cls', None) # type: ClsType["_models.UnresolvedDependencyCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01-preview" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -82,7 +85,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)