From b68aec880914c404e048e67e4e6516108ac12955 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 25 Jan 2021 03:30:13 +0000 Subject: [PATCH] CodeGen from PR 12514 in Azure/azure-rest-api-specs Adding key vault and DES resource settings. (#12514) --- .../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 +- ...nfiguration_async.py => _configuration.py} | 5 +- ...sync.py => _resource_mover_service_api.py} | 18 +- .../__init__.py | 8 +- .../_move_collections_operations.py} | 388 +++++++++++---- .../_move_resources_operations.py} | 83 ++-- .../_operations_discovery_operations.py} | 17 +- .../_unresolved_dependencies_operations.py | 131 +++++ ...nresolved_dependencies_operations_async.py | 96 ---- .../mgmt/resourcemover/models/__init__.py | 37 +- .../mgmt/resourcemover/models/_models.py | 432 ++++++++++++---- .../mgmt/resourcemover/models/_models_py3.py | 469 ++++++++++++++---- .../_resource_mover_service_api_enums.py | 115 +++-- .../_move_collections_operations.py | 390 +++++++++++---- .../operations/_move_resources_operations.py | 83 ++-- .../_operations_discovery_operations.py | 17 +- .../_unresolved_dependencies_operations.py | 117 +++-- 21 files changed, 1794 insertions(+), 647 deletions(-) rename sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/{_configuration_async.py => _configuration.py} (91%) rename sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/{_resource_mover_service_api_async.py => _resource_mover_service_api.py} (87%) rename sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/{operations_async => operations}/__init__.py (66%) rename sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/{operations_async/_move_collections_operations_async.py => operations/_move_collections_operations.py} (75%) rename sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/{operations_async/_move_resources_operations_async.py => operations/_move_resources_operations.py} (86%) rename sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/{operations_async/_operations_discovery_operations_async.py => operations/_operations_discovery_operations.py} (84%) create mode 100644 sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_unresolved_dependencies_operations.py delete mode 100644 sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations_async/_unresolved_dependencies_operations_async.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 a26441be9fd6b..055e320b7ba36 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 e95a95d31b286..d5a87ef6e72da 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 eb6983123964d..74f2d1abe6ff6 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 3fa7978c637e6..95e84007ac637 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 30a18f6e74334..f487634cb60ff 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_async.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/_configuration.py similarity index 91% rename from sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/_configuration_async.py rename to sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/_configuration.py index 6fe8878c7e56e..dc633dacd5533 100644 --- a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/_configuration_async.py +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/_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 @@ -45,8 +46,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) @@ -58,6 +58,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.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) diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/_resource_mover_service_api_async.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/_resource_mover_service_api.py similarity index 87% rename from sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/_resource_mover_service_api_async.py rename to sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/_resource_mover_service_api.py index 3d08451a3ff9c..b8db859a391fa 100644 --- a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/_resource_mover_service_api_async.py +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/_resource_mover_service_api.py @@ -15,11 +15,11 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration_async import ResourceMoverServiceAPIConfiguration -from .operations_async import MoveCollectionsOperations -from .operations_async import MoveResourcesOperations -from .operations_async import UnresolvedDependenciesOperations -from .operations_async import OperationsDiscoveryOperations +from ._configuration import ResourceMoverServiceAPIConfiguration +from .operations import MoveCollectionsOperations +from .operations import MoveResourcesOperations +from .operations import UnresolvedDependenciesOperations +from .operations import OperationsDiscoveryOperations from .. import models @@ -27,13 +27,13 @@ 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_async.MoveCollectionsOperations + :vartype move_collections: resource_mover_service_api.aio.operations.MoveCollectionsOperations :ivar move_resources: MoveResourcesOperations operations - :vartype move_resources: resource_mover_service_api.aio.operations_async.MoveResourcesOperations + :vartype move_resources: resource_mover_service_api.aio.operations.MoveResourcesOperations :ivar unresolved_dependencies: UnresolvedDependenciesOperations operations - :vartype unresolved_dependencies: resource_mover_service_api.aio.operations_async.UnresolvedDependenciesOperations + :vartype unresolved_dependencies: resource_mover_service_api.aio.operations.UnresolvedDependenciesOperations :ivar operations_discovery: OperationsDiscoveryOperations operations - :vartype operations_discovery: resource_mover_service_api.aio.operations_async.OperationsDiscoveryOperations + :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. diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations_async/__init__.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/__init__.py similarity index 66% rename from sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations_async/__init__.py rename to sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/__init__.py index 2d5f1a4233916..fb98319827bc2 100644 --- a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations_async/__init__.py +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/__init__.py @@ -6,10 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._move_collections_operations_async import MoveCollectionsOperations -from ._move_resources_operations_async import MoveResourcesOperations -from ._unresolved_dependencies_operations_async import UnresolvedDependenciesOperations -from ._operations_discovery_operations_async import OperationsDiscoveryOperations +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', diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations_async/_move_collections_operations_async.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_move_collections_operations.py similarity index 75% rename from sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations_async/_move_collections_operations_async.py rename to sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_move_collections_operations.py index 45707f2f6cfe2..561c257147805 100644 --- a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations_async/_move_collections_operations_async.py +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_move_collections_operations.py @@ -9,14 +9,14 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -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 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 +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class MoveCollectionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,9 +47,9 @@ async def create( self, resource_group_name: str, move_collection_name: str, - body: Optional["models.MoveCollection"] = None, + body: Optional["_models.MoveCollection"] = None, **kwargs - ) -> "models.MoveCollection": + ) -> "_models.MoveCollection": """Creates or updates a move collection. :param resource_group_name: The Resource Group Name. @@ -63,11 +63,14 @@ async 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 @@ -85,7 +88,7 @@ async 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: @@ -94,7 +97,6 @@ async 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 = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -118,9 +120,9 @@ async def update( self, resource_group_name: str, move_collection_name: str, - body: Optional["models.UpdateMoveCollectionRequest"] = None, + body: Optional["_models.UpdateMoveCollectionRequest"] = None, **kwargs - ) -> "models.MoveCollection": + ) -> "_models.MoveCollection": """Updates a move collection. :param resource_group_name: The Resource Group Name. @@ -134,11 +136,14 @@ async 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 @@ -156,7 +161,7 @@ async 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: @@ -165,7 +170,6 @@ async 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 = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -186,11 +190,14 @@ async def _delete_initial( resource_group_name: str, move_collection_name: str, **kwargs - ) -> Optional["models.OperationStatus"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.OperationStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + ) -> 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 @@ -207,7 +214,7 @@ async 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 = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -232,7 +239,7 @@ async def begin_delete( resource_group_name: str, move_collection_name: str, **kwargs - ) -> AsyncLROPoller["models.OperationStatus"]: + ) -> AsyncLROPoller["_models.OperationStatus"]: """Deletes a move collection. :param resource_group_name: The Resource Group Name. @@ -250,7 +257,7 @@ async def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - 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 @@ -274,7 +281,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(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 = 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: @@ -293,7 +306,7 @@ async def get( resource_group_name: str, move_collection_name: str, **kwargs - ) -> "models.MoveCollection": + ) -> "_models.MoveCollection": """Gets the move collection. :param resource_group_name: The Resource Group Name. @@ -305,10 +318,13 @@ async 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 @@ -325,7 +341,7 @@ async 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 = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -347,14 +363,17 @@ async def _prepare_initial( self, resource_group_name: str, move_collection_name: str, - body: Optional["models.PrepareRequest"] = None, + body: Optional["_models.PrepareRequest"] = None, **kwargs - ) -> Optional["models.OperationStatus"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.OperationStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + ) -> 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 @@ -372,7 +391,7 @@ async 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: @@ -381,7 +400,6 @@ async 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 = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -403,14 +421,14 @@ async def begin_prepare( self, resource_group_name: str, move_collection_name: str, - body: Optional["models.PrepareRequest"] = None, + body: Optional["_models.PrepareRequest"] = None, **kwargs - ) -> AsyncLROPoller["models.OperationStatus"]: + ) -> 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. + 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 @@ -429,7 +447,7 @@ async def begin_prepare( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - 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 @@ -454,7 +472,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(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 = 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: @@ -472,14 +496,17 @@ async def _initiate_move_initial( self, resource_group_name: str, move_collection_name: str, - body: Optional["models.ResourceMoveRequest"] = None, + body: Optional["_models.ResourceMoveRequest"] = None, **kwargs - ) -> Optional["models.OperationStatus"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.OperationStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + ) -> 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 @@ -497,7 +524,7 @@ async 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: @@ -506,7 +533,6 @@ async 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 = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -528,14 +554,14 @@ async def begin_initiate_move( self, resource_group_name: str, move_collection_name: str, - body: Optional["models.ResourceMoveRequest"] = None, + body: Optional["_models.ResourceMoveRequest"] = None, **kwargs - ) -> AsyncLROPoller["models.OperationStatus"]: + ) -> 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. + 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 @@ -554,7 +580,7 @@ async def begin_initiate_move( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - 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 @@ -579,7 +605,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(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 = 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: @@ -597,14 +629,17 @@ async def _commit_initial( self, resource_group_name: str, move_collection_name: str, - body: Optional["models.CommitRequest"] = None, + body: Optional["_models.CommitRequest"] = None, **kwargs - ) -> Optional["models.OperationStatus"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.OperationStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + ) -> 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 @@ -622,7 +657,7 @@ async 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: @@ -631,7 +666,6 @@ async 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 = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -653,14 +687,14 @@ async def begin_commit( self, resource_group_name: str, move_collection_name: str, - body: Optional["models.CommitRequest"] = None, + body: Optional["_models.CommitRequest"] = None, **kwargs - ) -> AsyncLROPoller["models.OperationStatus"]: + ) -> 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. + 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 @@ -679,7 +713,7 @@ async def begin_commit( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - 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 @@ -704,7 +738,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(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 = 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: @@ -722,14 +762,17 @@ async def _discard_initial( self, resource_group_name: str, move_collection_name: str, - body: Optional["models.DiscardRequest"] = None, + body: Optional["_models.DiscardRequest"] = None, **kwargs - ) -> Optional["models.OperationStatus"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.OperationStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + ) -> 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 @@ -747,7 +790,7 @@ async 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: @@ -756,7 +799,6 @@ async 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 = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -778,14 +820,14 @@ async def begin_discard( self, resource_group_name: str, move_collection_name: str, - body: Optional["models.DiscardRequest"] = None, + body: Optional["_models.DiscardRequest"] = None, **kwargs - ) -> AsyncLROPoller["models.OperationStatus"]: + ) -> 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. + 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 @@ -804,7 +846,7 @@ async def begin_discard( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - 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 @@ -829,7 +871,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(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 = 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: @@ -848,11 +896,14 @@ async def _resolve_dependencies_initial( resource_group_name: str, move_collection_name: str, **kwargs - ) -> Optional["models.OperationStatus"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.OperationStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + ) -> 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 @@ -869,7 +920,7 @@ async 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 = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -894,7 +945,7 @@ async def begin_resolve_dependencies( resource_group_name: str, move_collection_name: str, **kwargs - ) -> AsyncLROPoller["models.OperationStatus"]: + ) -> AsyncLROPoller["_models.OperationStatus"]: """Computes, resolves and validate the dependencies of the moveResources in the move collection. :param resource_group_name: The Resource Group Name. @@ -912,7 +963,7 @@ async def begin_resolve_dependencies( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - 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 @@ -936,7 +987,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(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 = 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: @@ -950,10 +1007,141 @@ def get_long_running_output(pipeline_response): 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"]: + ) -> AsyncIterable["_models.MoveCollectionResultList"]: """Get all Move Collections. Get all the Move Collections in the subscription. @@ -963,15 +1151,18 @@ def list_move_collections_by_subscription( :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 = {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 @@ -1019,7 +1210,7 @@ def list_move_collections_by_resource_group( self, resource_group_name: str, **kwargs - ) -> AsyncIterable["models.MoveCollectionResultList"]: + ) -> AsyncIterable["_models.MoveCollectionResultList"]: """Get all Move Collections. Get all the Move Collections in the resource group. @@ -1031,15 +1222,18 @@ def list_move_collections_by_resource_group( :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 = {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/aio/operations_async/_move_resources_operations_async.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_move_resources_operations.py similarity index 86% rename from sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations_async/_move_resources_operations_async.py rename to sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_move_resources_operations.py index 7278163004724..6daed387c2b0b 100644 --- a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations_async/_move_resources_operations_async.py +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_move_resources_operations.py @@ -9,14 +9,14 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -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 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 +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class MoveResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -49,7 +49,7 @@ def list( move_collection_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.MoveResourceCollection"]: + ) -> AsyncIterable["_models.MoveResourceCollection"]: """Lists the Move Resources in the move collection. :param resource_group_name: The Resource Group Name. @@ -57,22 +57,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.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 = {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 @@ -125,14 +128,17 @@ async def _create_initial( resource_group_name: str, move_collection_name: str, move_resource_name: str, - body: Optional["models.MoveResource"] = None, + body: Optional["_models.MoveResource"] = None, **kwargs - ) -> Optional["models.MoveResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MoveResource"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + ) -> 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 @@ -151,7 +157,7 @@ async 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: @@ -160,7 +166,6 @@ async 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 = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,9 +188,9 @@ async def begin_create( resource_group_name: str, move_collection_name: str, move_resource_name: str, - body: Optional["models.MoveResource"] = None, + body: Optional["_models.MoveResource"] = None, **kwargs - ) -> AsyncLROPoller["models.MoveResource"]: + ) -> AsyncLROPoller["_models.MoveResource"]: """Creates or updates a Move Resource in the move collection. :param resource_group_name: The Resource Group Name. @@ -207,7 +212,7 @@ async def begin_create( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - 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 @@ -233,7 +238,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(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 = 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: @@ -253,11 +265,14 @@ async def _delete_initial( move_collection_name: str, move_resource_name: str, **kwargs - ) -> Optional["models.OperationStatus"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.OperationStatus"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + ) -> 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 @@ -275,7 +290,7 @@ async 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 = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -301,7 +316,7 @@ async def begin_delete( move_collection_name: str, move_resource_name: str, **kwargs - ) -> AsyncLROPoller["models.OperationStatus"]: + ) -> AsyncLROPoller["_models.OperationStatus"]: """Deletes a Move Resource from the move collection. :param resource_group_name: The Resource Group Name. @@ -321,7 +336,7 @@ async def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - 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 @@ -346,7 +361,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(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 = 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: @@ -366,7 +388,7 @@ async def get( move_collection_name: str, move_resource_name: str, **kwargs - ) -> "models.MoveResource": + ) -> "_models.MoveResource": """Gets the Move Resource. :param resource_group_name: The Resource Group Name. @@ -380,10 +402,13 @@ async 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 @@ -401,7 +426,7 @@ async 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 = await self._client._pipeline.run(request, stream=False, **kwargs) diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations_async/_operations_discovery_operations_async.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_operations_discovery_operations.py similarity index 84% rename from sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations_async/_operations_discovery_operations_async.py rename to sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_operations_discovery_operations.py index ea062168c1d3a..e0eed18210bba 100644 --- a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations_async/_operations_discovery_operations_async.py +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_operations_discovery_operations.py @@ -8,12 +8,12 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar 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 AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class OperationsDiscoveryOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def get( self, **kwargs - ) -> "models.OperationsDiscoveryCollection": + ) -> "_models.OperationsDiscoveryCollection": """get. :keyword callable cls: A custom type or function that will be passed the direct response @@ -51,10 +51,13 @@ async 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 @@ -65,7 +68,7 @@ async 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 = await self._client._pipeline.run(request, stream=False, **kwargs) 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 0000000000000..ba69cb9c5053a --- /dev/null +++ b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations/_unresolved_dependencies_operations.py @@ -0,0 +1,131 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class 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 + + def get( + self, + resource_group_name: str, + move_collection_name: str, + dependency_level: Optional[Union[str, "_models.DependencyLevel"]] = None, + orderby: Optional[str] = None, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_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 + :param dependency_level: Defines the dependency level. + :type dependency_level: str or ~resource_mover_service_api.models.DependencyLevel + :param orderby: OData order by query option. For example, you can use $orderby=Count desc. + :type orderby: str + :param filter: The filter to apply on the operation. For example, $apply=filter(count eq 2). + :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 UnresolvedDependencyCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~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" + + 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.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] + if dependency_level is not None: + query_parameters['dependencyLevel'] = self._serialize.query("dependency_level", dependency_level, 'str') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + 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('UnresolvedDependencyCollection', 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 + ) + 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/aio/operations_async/_unresolved_dependencies_operations_async.py b/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations_async/_unresolved_dependencies_operations_async.py deleted file mode 100644 index f806c5e873c77..0000000000000 --- a/sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/aio/operations_async/_unresolved_dependencies_operations_async.py +++ /dev/null @@ -1,96 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import 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 - -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 = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-10-01-preview" - - # 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'] = 'application/json' - - 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 f11d29625f1b6..23c4dab6e1c3a 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,12 +11,15 @@ 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 + from ._models_py3 import DiskEncryptionSetResourceSettings from ._models_py3 import Display from ._models_py3 import Identity from ._models_py3 import JobStatus + from ._models_py3 import KeyVaultResourceSettings from ._models_py3 import LBBackendAddressPoolResourceSettings from ._models_py3 import LBFrontendIPConfigurationResourceSettings from ._models_py3 import LoadBalancerBackendAddressPoolReference @@ -25,6 +28,7 @@ from ._models_py3 import ManualResolutionProperties from ._models_py3 import MoveCollection from ._models_py3 import MoveCollectionProperties + from ._models_py3 import MoveCollectionPropertiesErrors from ._models_py3 import MoveCollectionResultList from ._models_py3 import MoveErrorInfo from ._models_py3 import MoveResource @@ -38,11 +42,11 @@ 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 from ._models_py3 import NicIpConfigurationResourceSettings + from ._models_py3 import NsgReference from ._models_py3 import NsgSecurityRule from ._models_py3 import OperationErrorAdditionalInfo from ._models_py3 import OperationStatus @@ -52,6 +56,7 @@ from ._models_py3 import PrepareRequest from ._models_py3 import ProxyResourceReference from ._models_py3 import PublicIPAddressResourceSettings + from ._models_py3 import PublicIpReference from ._models_py3 import ResourceGroupResourceSettings from ._models_py3 import ResourceMoveRequest from ._models_py3 import ResourceSettings @@ -60,6 +65,10 @@ 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 UnresolvedDependenciesFilter + from ._models_py3 import UnresolvedDependenciesFilterProperties from ._models_py3 import UnresolvedDependency from ._models_py3 import UnresolvedDependencyCollection from ._models_py3 import UpdateMoveCollectionRequest @@ -70,12 +79,15 @@ 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 + from ._models import DiskEncryptionSetResourceSettings # type: ignore from ._models import Display # type: ignore from ._models import Identity # type: ignore from ._models import JobStatus # type: ignore + from ._models import KeyVaultResourceSettings # type: ignore from ._models import LBBackendAddressPoolResourceSettings # type: ignore from ._models import LBFrontendIPConfigurationResourceSettings # type: ignore from ._models import LoadBalancerBackendAddressPoolReference # type: ignore @@ -84,6 +96,7 @@ from ._models import ManualResolutionProperties # type: ignore from ._models import MoveCollection # type: ignore from ._models import MoveCollectionProperties # type: ignore + from ._models import MoveCollectionPropertiesErrors # type: ignore from ._models import MoveCollectionResultList # type: ignore from ._models import MoveErrorInfo # type: ignore from ._models import MoveResource # type: ignore @@ -97,11 +110,11 @@ 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 from ._models import NicIpConfigurationResourceSettings # type: ignore + from ._models import NsgReference # type: ignore from ._models import NsgSecurityRule # type: ignore from ._models import OperationErrorAdditionalInfo # type: ignore from ._models import OperationStatus # type: ignore @@ -111,6 +124,7 @@ from ._models import PrepareRequest # type: ignore from ._models import ProxyResourceReference # type: ignore from ._models import PublicIPAddressResourceSettings # type: ignore + from ._models import PublicIpReference # type: ignore from ._models import ResourceGroupResourceSettings # type: ignore from ._models import ResourceMoveRequest # type: ignore from ._models import ResourceSettings # type: ignore @@ -119,6 +133,10 @@ 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 UnresolvedDependenciesFilter # type: ignore + from ._models import UnresolvedDependenciesFilterProperties # type: ignore from ._models import UnresolvedDependency # type: ignore from ._models import UnresolvedDependencyCollection # type: ignore from ._models import UpdateMoveCollectionRequest # type: ignore @@ -126,7 +144,9 @@ from ._models import VirtualNetworkResourceSettings # type: ignore from ._resource_mover_service_api_enums import ( + DependencyLevel, DependencyType, + JobName, MoveResourceInputType, MoveState, ProvisioningState, @@ -141,12 +161,15 @@ 'AutomaticResolutionProperties', 'AvailabilitySetResourceSettings', 'AzureResourceReference', + 'BulkRemoveRequest', 'CloudErrorBody', 'CommitRequest', 'DiscardRequest', + 'DiskEncryptionSetResourceSettings', 'Display', 'Identity', 'JobStatus', + 'KeyVaultResourceSettings', 'LBBackendAddressPoolResourceSettings', 'LBFrontendIPConfigurationResourceSettings', 'LoadBalancerBackendAddressPoolReference', @@ -155,6 +178,7 @@ 'ManualResolutionProperties', 'MoveCollection', 'MoveCollectionProperties', + 'MoveCollectionPropertiesErrors', 'MoveCollectionResultList', 'MoveErrorInfo', 'MoveResource', @@ -168,11 +192,11 @@ 'MoveResourceProperties', 'MoveResourcePropertiesErrors', 'MoveResourcePropertiesMoveStatus', - 'MoveResourcePropertiesSourceResourceSettings', 'MoveResourceStatus', 'NetworkInterfaceResourceSettings', 'NetworkSecurityGroupResourceSettings', 'NicIpConfigurationResourceSettings', + 'NsgReference', 'NsgSecurityRule', 'OperationErrorAdditionalInfo', 'OperationStatus', @@ -182,6 +206,7 @@ 'PrepareRequest', 'ProxyResourceReference', 'PublicIPAddressResourceSettings', + 'PublicIpReference', 'ResourceGroupResourceSettings', 'ResourceMoveRequest', 'ResourceSettings', @@ -190,12 +215,18 @@ 'SqlServerResourceSettings', 'SubnetReference', 'SubnetResourceSettings', + 'Summary', + 'SummaryCollection', + 'UnresolvedDependenciesFilter', + 'UnresolvedDependenciesFilterProperties', 'UnresolvedDependency', 'UnresolvedDependencyCollection', 'UpdateMoveCollectionRequest', 'VirtualMachineResourceSettings', 'VirtualNetworkResourceSettings', + 'DependencyLevel', '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 edad9e8e4f8b3..0970d9651e2ac 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, DiskEncryptionSetResourceSettings, VirtualMachineResourceSettings, KeyVaultResourceSettings, 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/diskEncryptionSets': 'DiskEncryptionSetResourceSettings', 'Microsoft.Compute/virtualMachines': 'VirtualMachineResourceSettings', 'Microsoft.KeyVault/vaults': 'KeyVaultResourceSettings', '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. @@ -274,6 +304,36 @@ def __init__( self.move_resource_input_type = kwargs.get('move_resource_input_type', None) +class DiskEncryptionSetResourceSettings(ResourceSettings): + """Defines the disk encryption set 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(DiskEncryptionSetResourceSettings, self).__init__(**kwargs) + self.resource_type = 'Microsoft.Compute/diskEncryptionSets' # type: str + + class Display(msrest.serialization.Model): """Contains the localized display information for this particular operation / action. These value will be used by several clients for @@ -368,14 +428,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 +444,6 @@ class JobStatus(msrest.serialization.Model): 'job_progress': {'key': 'jobProgress', 'type': 'str'}, } - job_name = "InitialSync" - def __init__( self, **kwargs @@ -395,6 +453,36 @@ def __init__( self.job_progress = None +class KeyVaultResourceSettings(ResourceSettings): + """Defines the key vault 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(KeyVaultResourceSettings, self).__init__(**kwargs) + self.resource_type = 'Microsoft.KeyVault/vaults' # type: str + + class LBBackendAddressPoolResourceSettings(msrest.serialization.Model): """Defines load balancer backend address pool properties. @@ -580,7 +668,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) @@ -618,6 +706,8 @@ class MoveCollection(msrest.serialization.Model): :vartype name: str :ivar type: The type of the resource. :vartype type: str + :ivar etag: The etag of the resource. + :vartype etag: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param location: The geo-location where the resource lives. @@ -632,12 +722,14 @@ class MoveCollection(msrest.serialization.Model): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'etag': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, 'identity': {'key': 'identity', 'type': 'Identity'}, @@ -652,6 +744,7 @@ def __init__( self.id = None self.name = None self.type = None + self.etag = None self.tags = kwargs.get('tags', None) self.location = kwargs.get('location', None) self.identity = kwargs.get('identity', None) @@ -672,18 +765,22 @@ class MoveCollectionProperties(msrest.serialization.Model): :ivar provisioning_state: Defines the provisioning states. Possible values include: "Succeeded", "Updating", "Creating", "Failed". :vartype provisioning_state: str or ~resource_mover_service_api.models.ProvisioningState + :ivar errors: Defines the move collection errors. + :vartype errors: ~resource_mover_service_api.models.MoveResourceError """ _validation = { 'source_region': {'required': True}, 'target_region': {'required': True}, 'provisioning_state': {'readonly': True}, + 'errors': {'readonly': True}, } _attribute_map = { 'source_region': {'key': 'sourceRegion', 'type': 'str'}, 'target_region': {'key': 'targetRegion', 'type': 'str'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'errors': {'key': 'errors', 'type': 'MoveResourceError'}, } def __init__( @@ -694,6 +791,44 @@ def __init__( self.source_region = kwargs['source_region'] self.target_region = kwargs['target_region'] self.provisioning_state = None + self.errors = None + + +class MoveResourceError(msrest.serialization.Model): + """An error response from the azure resource mover service. + + :param properties: The move resource error body. + :type properties: ~resource_mover_service_api.models.MoveResourceErrorBody + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'MoveResourceErrorBody'}, + } + + def __init__( + self, + **kwargs + ): + super(MoveResourceError, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class MoveCollectionPropertiesErrors(MoveResourceError): + """Defines the move collection errors. + + :param properties: The move resource error body. + :type properties: ~resource_mover_service_api.models.MoveResourceErrorBody + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'MoveResourceErrorBody'}, + } + + def __init__( + self, + **kwargs + ): + super(MoveCollectionPropertiesErrors, self).__init__(**kwargs) class MoveCollectionResultList(msrest.serialization.Model): @@ -786,15 +921,28 @@ def __init__( class MoveResourceCollection(msrest.serialization.Model): """Defines the collection of move resources. + Variables are only populated by the server, and will be ignored when sending a request. + :param value: Gets the list of move resources. :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 + :ivar total_count: Gets the total count. + :vartype total_count: long """ + _validation = { + 'total_count': {'readonly': True}, + } + _attribute_map = { 'value': {'key': 'value', 'type': '[MoveResource]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'summary_collection': {'key': 'summaryCollection', 'type': 'SummaryCollection'}, + 'total_count': {'key': 'totalCount', 'type': 'long'}, } def __init__( @@ -804,6 +952,8 @@ 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) + self.total_count = None class MoveResourceDependency(msrest.serialization.Model): @@ -876,25 +1026,6 @@ def __init__( self.target_id = kwargs.get('target_id', None) -class MoveResourceError(msrest.serialization.Model): - """An error response from the azure resource mover service. - - :param properties: The move resource error body. - :type properties: ~resource_mover_service_api.models.MoveResourceErrorBody - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'MoveResourceErrorBody'}, - } - - def __init__( - self, - **kwargs - ): - super(MoveResourceError, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - class MoveResourceErrorBody(msrest.serialization.Model): """An error response from the Azure Migrate service. @@ -1003,6 +1134,9 @@ class MoveResourceProperties(msrest.serialization.Model): :param depends_on_overrides: Gets or sets the move resource dependencies overrides. :type depends_on_overrides: list[~resource_mover_service_api.models.MoveResourceDependencyOverride] + :ivar is_resolve_required: Gets a value indicating whether the resolve action is required over + the move collection. + :vartype is_resolve_required: bool :ivar errors: Defines the move resource errors. :vartype errors: ~resource_mover_service_api.models.MoveResourceError """ @@ -1014,6 +1148,7 @@ class MoveResourceProperties(msrest.serialization.Model): 'source_resource_settings': {'readonly': True}, 'move_status': {'readonly': True}, 'depends_on': {'readonly': True}, + 'is_resolve_required': {'readonly': True}, 'errors': {'readonly': True}, } @@ -1027,6 +1162,7 @@ class MoveResourceProperties(msrest.serialization.Model): 'move_status': {'key': 'moveStatus', 'type': 'MoveResourceStatus'}, 'depends_on': {'key': 'dependsOn', 'type': '[MoveResourceDependency]'}, 'depends_on_overrides': {'key': 'dependsOnOverrides', 'type': '[MoveResourceDependencyOverride]'}, + 'is_resolve_required': {'key': 'isResolveRequired', 'type': 'bool'}, 'errors': {'key': 'errors', 'type': 'MoveResourceError'}, } @@ -1044,6 +1180,7 @@ def __init__( self.move_status = None self.depends_on = None self.depends_on_overrides = kwargs.get('depends_on_overrides', None) + self.is_resolve_required = None self.errors = None @@ -1073,26 +1210,23 @@ class MoveResourceStatus(msrest.serialization.Model): :ivar move_state: Defines the MoveResource states. Possible values include: "AssignmentPending", "PreparePending", "PrepareInProgress", "PrepareFailed", "MovePending", "MoveInProgress", "MoveFailed", "DiscardInProgress", "DiscardFailed", "CommitPending", - "CommitInProgress", "CommitFailed", "Committed". + "CommitInProgress", "CommitFailed", "Committed", "DeleteSourcePending", + "ResourceMoveCompleted". :vartype move_state: str or ~resource_mover_service_api.models.MoveState :param job_status: Defines the job status. :type job_status: ~resource_mover_service_api.models.JobStatus :param errors: An error response from the azure resource mover service. :type errors: ~resource_mover_service_api.models.MoveResourceError - :ivar target_id: Gets the Target ARM Id of the resource. - :vartype target_id: str """ _validation = { 'move_state': {'readonly': True}, - 'target_id': {'readonly': True}, } _attribute_map = { 'move_state': {'key': 'moveState', 'type': 'str'}, 'job_status': {'key': 'jobStatus', 'type': 'JobStatus'}, 'errors': {'key': 'errors', 'type': 'MoveResourceError'}, - 'target_id': {'key': 'targetId', 'type': 'str'}, } def __init__( @@ -1103,7 +1237,6 @@ def __init__( self.move_state = None self.job_status = kwargs.get('job_status', None) self.errors = kwargs.get('errors', None) - self.target_id = None class MoveResourcePropertiesMoveStatus(MoveResourceStatus): @@ -1114,26 +1247,23 @@ class MoveResourcePropertiesMoveStatus(MoveResourceStatus): :ivar move_state: Defines the MoveResource states. Possible values include: "AssignmentPending", "PreparePending", "PrepareInProgress", "PrepareFailed", "MovePending", "MoveInProgress", "MoveFailed", "DiscardInProgress", "DiscardFailed", "CommitPending", - "CommitInProgress", "CommitFailed", "Committed". + "CommitInProgress", "CommitFailed", "Committed", "DeleteSourcePending", + "ResourceMoveCompleted". :vartype move_state: str or ~resource_mover_service_api.models.MoveState :param job_status: Defines the job status. :type job_status: ~resource_mover_service_api.models.JobStatus :param errors: An error response from the azure resource mover service. :type errors: ~resource_mover_service_api.models.MoveResourceError - :ivar target_id: Gets the Target ARM Id of the resource. - :vartype target_id: str """ _validation = { 'move_state': {'readonly': True}, - 'target_id': {'readonly': True}, } _attribute_map = { 'move_state': {'key': 'moveState', 'type': 'str'}, 'job_status': {'key': 'jobStatus', 'type': 'JobStatus'}, 'errors': {'key': 'errors', 'type': 'MoveResourceError'}, - 'target_id': {'key': 'targetId', 'type': 'str'}, } def __init__( @@ -1143,36 +1273,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 +1308,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 +1343,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) @@ -1265,6 +1365,10 @@ class NicIpConfigurationResourceSettings(msrest.serialization.Model): backend address pools. :type load_balancer_backend_address_pools: list[~resource_mover_service_api.models.ProxyResourceReference] + :param load_balancer_nat_rules: Gets or sets the references of the load balancer NAT rules. + :type load_balancer_nat_rules: list[~resource_mover_service_api.models.ProxyResourceReference] + :param public_ip: Defines reference to an Azure resource. + :type public_ip: ~resource_mover_service_api.models.AzureResourceReference """ _attribute_map = { @@ -1274,6 +1378,8 @@ class NicIpConfigurationResourceSettings(msrest.serialization.Model): 'subnet': {'key': 'subnet', 'type': 'ProxyResourceReference'}, 'primary': {'key': 'primary', 'type': 'bool'}, 'load_balancer_backend_address_pools': {'key': 'loadBalancerBackendAddressPools', 'type': '[ProxyResourceReference]'}, + 'load_balancer_nat_rules': {'key': 'loadBalancerNatRules', 'type': '[ProxyResourceReference]'}, + 'public_ip': {'key': 'publicIp', 'type': 'AzureResourceReference'}, } def __init__( @@ -1287,6 +1393,33 @@ def __init__( self.subnet = kwargs.get('subnet', None) self.primary = kwargs.get('primary', None) self.load_balancer_backend_address_pools = kwargs.get('load_balancer_backend_address_pools', None) + self.load_balancer_nat_rules = kwargs.get('load_balancer_nat_rules', None) + self.public_ip = kwargs.get('public_ip', None) + + +class NsgReference(AzureResourceReference): + """Defines reference to NSG. + + All required parameters must be populated in order to send to Azure. + + :param source_arm_resource_id: Required. Gets the ARM resource ID of the tracked resource being + referenced. + :type source_arm_resource_id: str + """ + + _validation = { + 'source_arm_resource_id': {'required': True}, + } + + _attribute_map = { + 'source_arm_resource_id': {'key': 'sourceArmResourceId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NsgReference, self).__init__(**kwargs) class NsgSecurityRule(msrest.serialization.Model): @@ -1416,6 +1549,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 +1569,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 +1581,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) @@ -1617,8 +1754,8 @@ class PublicIPAddressResourceSettings(ResourceSettings): :type target_resource_name: str :param domain_name_label: Gets or sets the domain name label. :type domain_name_label: str - :param f_qdn: Gets or sets the fully qualified domain name. - :type f_qdn: str + :param fqdn: Gets or sets the fully qualified domain name. + :type fqdn: str :param public_ip_allocation_method: Gets or sets public IP allocation method. :type public_ip_allocation_method: str :param sku: Gets or sets public IP sku. @@ -1636,7 +1773,7 @@ class PublicIPAddressResourceSettings(ResourceSettings): 'resource_type': {'key': 'resourceType', 'type': 'str'}, 'target_resource_name': {'key': 'targetResourceName', 'type': 'str'}, 'domain_name_label': {'key': 'domainNameLabel', 'type': 'str'}, - 'f_qdn': {'key': 'fQDN', 'type': 'str'}, + 'fqdn': {'key': 'fqdn', 'type': 'str'}, 'public_ip_allocation_method': {'key': 'publicIpAllocationMethod', 'type': 'str'}, 'sku': {'key': 'sku', 'type': 'str'}, 'zones': {'key': 'zones', 'type': 'str'}, @@ -1647,14 +1784,39 @@ 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.fqdn = kwargs.get('fqdn', None) self.public_ip_allocation_method = kwargs.get('public_ip_allocation_method', None) self.sku = kwargs.get('sku', None) self.zones = kwargs.get('zones', None) +class PublicIpReference(AzureResourceReference): + """Defines reference to a public IP. + + All required parameters must be populated in order to send to Azure. + + :param source_arm_resource_id: Required. Gets the ARM resource ID of the tracked resource being + referenced. + :type source_arm_resource_id: str + """ + + _validation = { + 'source_arm_resource_id': {'required': True}, + } + + _attribute_map = { + 'source_arm_resource_id': {'key': 'sourceArmResourceId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PublicIpReference, self).__init__(**kwargs) + + class ResourceGroupResourceSettings(ResourceSettings): """Defines the resource group resource settings. @@ -1682,7 +1844,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 +1914,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 +1949,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 +1980,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): @@ -1856,11 +2018,14 @@ class SubnetResourceSettings(msrest.serialization.Model): :type name: str :param address_prefix: Gets or sets address prefix for the subnet. :type address_prefix: str + :param network_security_group: Defines reference to an Azure resource. + :type network_security_group: ~resource_mover_service_api.models.AzureResourceReference """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'address_prefix': {'key': 'addressPrefix', 'type': 'str'}, + 'network_security_group': {'key': 'networkSecurityGroup', 'type': 'AzureResourceReference'}, } def __init__( @@ -1870,6 +2035,91 @@ def __init__( super(SubnetResourceSettings, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.address_prefix = kwargs.get('address_prefix', None) + self.network_security_group = kwargs.get('network_security_group', 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 UnresolvedDependenciesFilter(msrest.serialization.Model): + """Unresolved dependencies contract. + + :param properties: + :type properties: ~resource_mover_service_api.models.UnresolvedDependenciesFilterProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'UnresolvedDependenciesFilterProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(UnresolvedDependenciesFilter, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class UnresolvedDependenciesFilterProperties(msrest.serialization.Model): + """UnresolvedDependenciesFilterProperties. + + :param count: The count of the resource. + :type count: int + """ + + _attribute_map = { + 'count': {'key': 'count', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(UnresolvedDependenciesFilterProperties, self).__init__(**kwargs) + self.count = kwargs.get('count', None) class UnresolvedDependency(msrest.serialization.Model): @@ -1898,15 +2148,29 @@ def __init__( class UnresolvedDependencyCollection(msrest.serialization.Model): """Unresolved dependency collection. + Variables are only populated by the server, and will be ignored when sending a request. + :param value: Gets or sets the list of unresolved dependencies. :type value: list[~resource_mover_service_api.models.UnresolvedDependency] :param next_link: Gets or sets the value of next link. :type next_link: str + :ivar summary_collection: Gets or sets the list of summary items and the field on which summary + is done. + :vartype summary_collection: ~resource_mover_service_api.models.SummaryCollection + :ivar total_count: Gets the total count. + :vartype total_count: long """ + _validation = { + 'summary_collection': {'readonly': True}, + 'total_count': {'readonly': True}, + } + _attribute_map = { 'value': {'key': 'value', 'type': '[UnresolvedDependency]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'summary_collection': {'key': 'summaryCollection', 'type': 'SummaryCollection'}, + 'total_count': {'key': 'totalCount', 'type': 'long'}, } def __init__( @@ -1916,6 +2180,8 @@ def __init__( super(UnresolvedDependencyCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) + self.summary_collection = None + self.total_count = None class UpdateMoveCollectionRequest(msrest.serialization.Model): @@ -1980,7 +2246,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 +2294,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 5b274ca100a34..81f978b27fafb 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, DiskEncryptionSetResourceSettings, VirtualMachineResourceSettings, KeyVaultResourceSettings, 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/diskEncryptionSets': 'DiskEncryptionSetResourceSettings', 'Microsoft.Compute/virtualMachines': 'VirtualMachineResourceSettings', 'Microsoft.KeyVault/vaults': 'KeyVaultResourceSettings', '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. @@ -301,6 +335,38 @@ def __init__( self.move_resource_input_type = move_resource_input_type +class DiskEncryptionSetResourceSettings(ResourceSettings): + """Defines the disk encryption set 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(DiskEncryptionSetResourceSettings, self).__init__(target_resource_name=target_resource_name, **kwargs) + self.resource_type = 'Microsoft.Compute/diskEncryptionSets' # type: str + + class Display(msrest.serialization.Model): """Contains the localized display information for this particular operation / action. These value will be used by several clients for @@ -404,14 +470,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 +486,6 @@ class JobStatus(msrest.serialization.Model): 'job_progress': {'key': 'jobProgress', 'type': 'str'}, } - job_name = "InitialSync" - def __init__( self, **kwargs @@ -431,6 +495,38 @@ def __init__( self.job_progress = None +class KeyVaultResourceSettings(ResourceSettings): + """Defines the key vault 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(KeyVaultResourceSettings, self).__init__(target_resource_name=target_resource_name, **kwargs) + self.resource_type = 'Microsoft.KeyVault/vaults' # type: str + + class LBBackendAddressPoolResourceSettings(msrest.serialization.Model): """Defines load balancer backend address pool properties. @@ -639,7 +735,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 @@ -679,6 +775,8 @@ class MoveCollection(msrest.serialization.Model): :vartype name: str :ivar type: The type of the resource. :vartype type: str + :ivar etag: The etag of the resource. + :vartype etag: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param location: The geo-location where the resource lives. @@ -693,12 +791,14 @@ class MoveCollection(msrest.serialization.Model): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'etag': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, 'identity': {'key': 'identity', 'type': 'Identity'}, @@ -718,6 +818,7 @@ def __init__( self.id = None self.name = None self.type = None + self.etag = None self.tags = tags self.location = location self.identity = identity @@ -738,18 +839,22 @@ class MoveCollectionProperties(msrest.serialization.Model): :ivar provisioning_state: Defines the provisioning states. Possible values include: "Succeeded", "Updating", "Creating", "Failed". :vartype provisioning_state: str or ~resource_mover_service_api.models.ProvisioningState + :ivar errors: Defines the move collection errors. + :vartype errors: ~resource_mover_service_api.models.MoveResourceError """ _validation = { 'source_region': {'required': True}, 'target_region': {'required': True}, 'provisioning_state': {'readonly': True}, + 'errors': {'readonly': True}, } _attribute_map = { 'source_region': {'key': 'sourceRegion', 'type': 'str'}, 'target_region': {'key': 'targetRegion', 'type': 'str'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'errors': {'key': 'errors', 'type': 'MoveResourceError'}, } def __init__( @@ -763,6 +868,48 @@ def __init__( self.source_region = source_region self.target_region = target_region self.provisioning_state = None + self.errors = None + + +class MoveResourceError(msrest.serialization.Model): + """An error response from the azure resource mover service. + + :param properties: The move resource error body. + :type properties: ~resource_mover_service_api.models.MoveResourceErrorBody + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'MoveResourceErrorBody'}, + } + + def __init__( + self, + *, + properties: Optional["MoveResourceErrorBody"] = None, + **kwargs + ): + super(MoveResourceError, self).__init__(**kwargs) + self.properties = properties + + +class MoveCollectionPropertiesErrors(MoveResourceError): + """Defines the move collection errors. + + :param properties: The move resource error body. + :type properties: ~resource_mover_service_api.models.MoveResourceErrorBody + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'MoveResourceErrorBody'}, + } + + def __init__( + self, + *, + properties: Optional["MoveResourceErrorBody"] = None, + **kwargs + ): + super(MoveCollectionPropertiesErrors, self).__init__(properties=properties, **kwargs) class MoveCollectionResultList(msrest.serialization.Model): @@ -860,15 +1007,28 @@ def __init__( class MoveResourceCollection(msrest.serialization.Model): """Defines the collection of move resources. + Variables are only populated by the server, and will be ignored when sending a request. + :param value: Gets the list of move resources. :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 + :ivar total_count: Gets the total count. + :vartype total_count: long """ + _validation = { + 'total_count': {'readonly': True}, + } + _attribute_map = { 'value': {'key': 'value', 'type': '[MoveResource]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'summary_collection': {'key': 'summaryCollection', 'type': 'SummaryCollection'}, + 'total_count': {'key': 'totalCount', 'type': 'long'}, } def __init__( @@ -876,11 +1036,14 @@ 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 + self.total_count = None class MoveResourceDependency(msrest.serialization.Model): @@ -964,27 +1127,6 @@ def __init__( self.target_id = target_id -class MoveResourceError(msrest.serialization.Model): - """An error response from the azure resource mover service. - - :param properties: The move resource error body. - :type properties: ~resource_mover_service_api.models.MoveResourceErrorBody - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'MoveResourceErrorBody'}, - } - - def __init__( - self, - *, - properties: Optional["MoveResourceErrorBody"] = None, - **kwargs - ): - super(MoveResourceError, self).__init__(**kwargs) - self.properties = properties - - class MoveResourceErrorBody(msrest.serialization.Model): """An error response from the Azure Migrate service. @@ -1097,6 +1239,9 @@ class MoveResourceProperties(msrest.serialization.Model): :param depends_on_overrides: Gets or sets the move resource dependencies overrides. :type depends_on_overrides: list[~resource_mover_service_api.models.MoveResourceDependencyOverride] + :ivar is_resolve_required: Gets a value indicating whether the resolve action is required over + the move collection. + :vartype is_resolve_required: bool :ivar errors: Defines the move resource errors. :vartype errors: ~resource_mover_service_api.models.MoveResourceError """ @@ -1108,6 +1253,7 @@ class MoveResourceProperties(msrest.serialization.Model): 'source_resource_settings': {'readonly': True}, 'move_status': {'readonly': True}, 'depends_on': {'readonly': True}, + 'is_resolve_required': {'readonly': True}, 'errors': {'readonly': True}, } @@ -1121,6 +1267,7 @@ class MoveResourceProperties(msrest.serialization.Model): 'move_status': {'key': 'moveStatus', 'type': 'MoveResourceStatus'}, 'depends_on': {'key': 'dependsOn', 'type': '[MoveResourceDependency]'}, 'depends_on_overrides': {'key': 'dependsOnOverrides', 'type': '[MoveResourceDependencyOverride]'}, + 'is_resolve_required': {'key': 'isResolveRequired', 'type': 'bool'}, 'errors': {'key': 'errors', 'type': 'MoveResourceError'}, } @@ -1143,6 +1290,7 @@ def __init__( self.move_status = None self.depends_on = None self.depends_on_overrides = depends_on_overrides + self.is_resolve_required = None self.errors = None @@ -1174,26 +1322,23 @@ class MoveResourceStatus(msrest.serialization.Model): :ivar move_state: Defines the MoveResource states. Possible values include: "AssignmentPending", "PreparePending", "PrepareInProgress", "PrepareFailed", "MovePending", "MoveInProgress", "MoveFailed", "DiscardInProgress", "DiscardFailed", "CommitPending", - "CommitInProgress", "CommitFailed", "Committed". + "CommitInProgress", "CommitFailed", "Committed", "DeleteSourcePending", + "ResourceMoveCompleted". :vartype move_state: str or ~resource_mover_service_api.models.MoveState :param job_status: Defines the job status. :type job_status: ~resource_mover_service_api.models.JobStatus :param errors: An error response from the azure resource mover service. :type errors: ~resource_mover_service_api.models.MoveResourceError - :ivar target_id: Gets the Target ARM Id of the resource. - :vartype target_id: str """ _validation = { 'move_state': {'readonly': True}, - 'target_id': {'readonly': True}, } _attribute_map = { 'move_state': {'key': 'moveState', 'type': 'str'}, 'job_status': {'key': 'jobStatus', 'type': 'JobStatus'}, 'errors': {'key': 'errors', 'type': 'MoveResourceError'}, - 'target_id': {'key': 'targetId', 'type': 'str'}, } def __init__( @@ -1207,7 +1352,6 @@ def __init__( self.move_state = None self.job_status = job_status self.errors = errors - self.target_id = None class MoveResourcePropertiesMoveStatus(MoveResourceStatus): @@ -1218,26 +1362,23 @@ class MoveResourcePropertiesMoveStatus(MoveResourceStatus): :ivar move_state: Defines the MoveResource states. Possible values include: "AssignmentPending", "PreparePending", "PrepareInProgress", "PrepareFailed", "MovePending", "MoveInProgress", "MoveFailed", "DiscardInProgress", "DiscardFailed", "CommitPending", - "CommitInProgress", "CommitFailed", "Committed". + "CommitInProgress", "CommitFailed", "Committed", "DeleteSourcePending", + "ResourceMoveCompleted". :vartype move_state: str or ~resource_mover_service_api.models.MoveState :param job_status: Defines the job status. :type job_status: ~resource_mover_service_api.models.JobStatus :param errors: An error response from the azure resource mover service. :type errors: ~resource_mover_service_api.models.MoveResourceError - :ivar target_id: Gets the Target ARM Id of the resource. - :vartype target_id: str """ _validation = { 'move_state': {'readonly': True}, - 'target_id': {'readonly': True}, } _attribute_map = { 'move_state': {'key': 'moveState', 'type': 'str'}, 'job_status': {'key': 'jobStatus', 'type': 'JobStatus'}, 'errors': {'key': 'errors', 'type': 'MoveResourceError'}, - 'target_id': {'key': 'targetId', 'type': 'str'}, } def __init__( @@ -1250,38 +1391,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 +1430,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 +1468,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 @@ -1381,6 +1490,10 @@ class NicIpConfigurationResourceSettings(msrest.serialization.Model): backend address pools. :type load_balancer_backend_address_pools: list[~resource_mover_service_api.models.ProxyResourceReference] + :param load_balancer_nat_rules: Gets or sets the references of the load balancer NAT rules. + :type load_balancer_nat_rules: list[~resource_mover_service_api.models.ProxyResourceReference] + :param public_ip: Defines reference to an Azure resource. + :type public_ip: ~resource_mover_service_api.models.AzureResourceReference """ _attribute_map = { @@ -1390,6 +1503,8 @@ class NicIpConfigurationResourceSettings(msrest.serialization.Model): 'subnet': {'key': 'subnet', 'type': 'ProxyResourceReference'}, 'primary': {'key': 'primary', 'type': 'bool'}, 'load_balancer_backend_address_pools': {'key': 'loadBalancerBackendAddressPools', 'type': '[ProxyResourceReference]'}, + 'load_balancer_nat_rules': {'key': 'loadBalancerNatRules', 'type': '[ProxyResourceReference]'}, + 'public_ip': {'key': 'publicIp', 'type': 'AzureResourceReference'}, } def __init__( @@ -1401,6 +1516,8 @@ def __init__( subnet: Optional["ProxyResourceReference"] = None, primary: Optional[bool] = None, load_balancer_backend_address_pools: Optional[List["ProxyResourceReference"]] = None, + load_balancer_nat_rules: Optional[List["ProxyResourceReference"]] = None, + public_ip: Optional["AzureResourceReference"] = None, **kwargs ): super(NicIpConfigurationResourceSettings, self).__init__(**kwargs) @@ -1410,6 +1527,35 @@ def __init__( self.subnet = subnet self.primary = primary self.load_balancer_backend_address_pools = load_balancer_backend_address_pools + self.load_balancer_nat_rules = load_balancer_nat_rules + self.public_ip = public_ip + + +class NsgReference(AzureResourceReference): + """Defines reference to NSG. + + All required parameters must be populated in order to send to Azure. + + :param source_arm_resource_id: Required. Gets the ARM resource ID of the tracked resource being + referenced. + :type source_arm_resource_id: str + """ + + _validation = { + 'source_arm_resource_id': {'required': True}, + } + + _attribute_map = { + 'source_arm_resource_id': {'key': 'sourceArmResourceId', 'type': 'str'}, + } + + def __init__( + self, + *, + source_arm_resource_id: str, + **kwargs + ): + super(NsgReference, self).__init__(source_arm_resource_id=source_arm_resource_id, **kwargs) class NsgSecurityRule(msrest.serialization.Model): @@ -1550,6 +1696,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 +1716,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 +1726,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 +1734,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 @@ -1763,8 +1914,8 @@ class PublicIPAddressResourceSettings(ResourceSettings): :type target_resource_name: str :param domain_name_label: Gets or sets the domain name label. :type domain_name_label: str - :param f_qdn: Gets or sets the fully qualified domain name. - :type f_qdn: str + :param fqdn: Gets or sets the fully qualified domain name. + :type fqdn: str :param public_ip_allocation_method: Gets or sets public IP allocation method. :type public_ip_allocation_method: str :param sku: Gets or sets public IP sku. @@ -1782,7 +1933,7 @@ class PublicIPAddressResourceSettings(ResourceSettings): 'resource_type': {'key': 'resourceType', 'type': 'str'}, 'target_resource_name': {'key': 'targetResourceName', 'type': 'str'}, 'domain_name_label': {'key': 'domainNameLabel', 'type': 'str'}, - 'f_qdn': {'key': 'fQDN', 'type': 'str'}, + 'fqdn': {'key': 'fqdn', 'type': 'str'}, 'public_ip_allocation_method': {'key': 'publicIpAllocationMethod', 'type': 'str'}, 'sku': {'key': 'sku', 'type': 'str'}, 'zones': {'key': 'zones', 'type': 'str'}, @@ -1793,21 +1944,48 @@ def __init__( *, target_resource_name: str, domain_name_label: Optional[str] = None, - f_qdn: Optional[str] = None, + fqdn: Optional[str] = None, public_ip_allocation_method: Optional[str] = None, sku: Optional[str] = None, zones: Optional[str] = None, **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.fqdn = fqdn self.public_ip_allocation_method = public_ip_allocation_method self.sku = sku self.zones = zones +class PublicIpReference(AzureResourceReference): + """Defines reference to a public IP. + + All required parameters must be populated in order to send to Azure. + + :param source_arm_resource_id: Required. Gets the ARM resource ID of the tracked resource being + referenced. + :type source_arm_resource_id: str + """ + + _validation = { + 'source_arm_resource_id': {'required': True}, + } + + _attribute_map = { + 'source_arm_resource_id': {'key': 'sourceArmResourceId', 'type': 'str'}, + } + + def __init__( + self, + *, + source_arm_resource_id: str, + **kwargs + ): + super(PublicIpReference, self).__init__(source_arm_resource_id=source_arm_resource_id, **kwargs) + + class ResourceGroupResourceSettings(ResourceSettings): """Defines the resource group resource settings. @@ -1837,7 +2015,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 +2092,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 +2130,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 +2163,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): @@ -2026,11 +2204,14 @@ class SubnetResourceSettings(msrest.serialization.Model): :type name: str :param address_prefix: Gets or sets address prefix for the subnet. :type address_prefix: str + :param network_security_group: Defines reference to an Azure resource. + :type network_security_group: ~resource_mover_service_api.models.AzureResourceReference """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'address_prefix': {'key': 'addressPrefix', 'type': 'str'}, + 'network_security_group': {'key': 'networkSecurityGroup', 'type': 'AzureResourceReference'}, } def __init__( @@ -2038,11 +2219,107 @@ def __init__( *, name: Optional[str] = None, address_prefix: Optional[str] = None, + network_security_group: Optional["AzureResourceReference"] = None, **kwargs ): super(SubnetResourceSettings, self).__init__(**kwargs) self.name = name self.address_prefix = address_prefix + self.network_security_group = network_security_group + + +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 UnresolvedDependenciesFilter(msrest.serialization.Model): + """Unresolved dependencies contract. + + :param properties: + :type properties: ~resource_mover_service_api.models.UnresolvedDependenciesFilterProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'UnresolvedDependenciesFilterProperties'}, + } + + def __init__( + self, + *, + properties: Optional["UnresolvedDependenciesFilterProperties"] = None, + **kwargs + ): + super(UnresolvedDependenciesFilter, self).__init__(**kwargs) + self.properties = properties + + +class UnresolvedDependenciesFilterProperties(msrest.serialization.Model): + """UnresolvedDependenciesFilterProperties. + + :param count: The count of the resource. + :type count: int + """ + + _attribute_map = { + 'count': {'key': 'count', 'type': 'int'}, + } + + def __init__( + self, + *, + count: Optional[int] = None, + **kwargs + ): + super(UnresolvedDependenciesFilterProperties, self).__init__(**kwargs) + self.count = count class UnresolvedDependency(msrest.serialization.Model): @@ -2074,15 +2351,29 @@ def __init__( class UnresolvedDependencyCollection(msrest.serialization.Model): """Unresolved dependency collection. + Variables are only populated by the server, and will be ignored when sending a request. + :param value: Gets or sets the list of unresolved dependencies. :type value: list[~resource_mover_service_api.models.UnresolvedDependency] :param next_link: Gets or sets the value of next link. :type next_link: str + :ivar summary_collection: Gets or sets the list of summary items and the field on which summary + is done. + :vartype summary_collection: ~resource_mover_service_api.models.SummaryCollection + :ivar total_count: Gets the total count. + :vartype total_count: long """ + _validation = { + 'summary_collection': {'readonly': True}, + 'total_count': {'readonly': True}, + } + _attribute_map = { 'value': {'key': 'value', 'type': '[UnresolvedDependency]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'summary_collection': {'key': 'summaryCollection', 'type': 'SummaryCollection'}, + 'total_count': {'key': 'totalCount', 'type': 'long'}, } def __init__( @@ -2095,6 +2386,8 @@ def __init__( super(UnresolvedDependencyCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link + self.summary_collection = None + self.total_count = None class UpdateMoveCollectionRequest(msrest.serialization.Model): @@ -2167,7 +2460,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 +2514,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 51532630f9d8e..c1480e111a720 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,107 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum +from enum import Enum, EnumMeta +from six import with_metaclass -class DependencyType(str, Enum): +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 DependencyLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + DIRECT = "Direct" + DESCENDANT = "Descendant" + +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" + DELETE_SOURCE_PENDING = "DeleteSourcePending" + RESOURCE_MOVE_COMPLETED = "ResourceMoveCompleted" + +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 4ac913c942c89..79f2338b1cd35 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 df788568ba544..3c3e925fe979c 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 3a0e1c49c8686..dfe92e8cf1ade 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 3ab01138bfe29..87c7520a9d6d5 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,16 +8,17 @@ 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 from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +37,7 @@ class UnresolvedDependenciesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,54 +49,88 @@ def get( self, resource_group_name, # type: str move_collection_name, # type: str + dependency_level=None, # type: Optional[Union[str, "_models.DependencyLevel"]] + orderby=None, # type: Optional[str] + filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.UnresolvedDependencyCollection" + # type: (...) -> Iterable["_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 + :param dependency_level: Defines the dependency level. + :type dependency_level: str or ~resource_mover_service_api.models.DependencyLevel + :param orderby: OData order by query option. For example, you can use $orderby=Count desc. + :type orderby: str + :param filter: The filter to apply on the operation. For example, $apply=filter(count eq 2). + :type filter: 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 + :return: An iterator like instance of either UnresolvedDependencyCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~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" - - # 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'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('UnresolvedDependencyCollection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + 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.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] + if dependency_level is not None: + query_parameters['dependencyLevel'] = self._serialize.query("dependency_level", dependency_level, 'str') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('UnresolvedDependencyCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/unresolvedDependencies'} # type: ignore