diff --git a/sdk/storage/azure-mgmt-storagesync/_meta.json b/sdk/storage/azure-mgmt-storagesync/_meta.json index 118b09547900..c063ac62e6ef 100644 --- a/sdk/storage/azure-mgmt-storagesync/_meta.json +++ b/sdk/storage/azure-mgmt-storagesync/_meta.json @@ -1,8 +1,11 @@ { - "autorest": "3.0.6369", - "use": "@autorest/python@5.6.2", - "commit": "18ed65c7581a1142c0015451e4d61ef0a3797268", + "autorest": "3.7.2", + "use": [ + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" + ], + "commit": "186a6da8b26804cd434bb1b8557812967ec69cd8", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/storagesync/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.6.2 --version=3.0.6369", + "autorest_command": "autorest specification/storagesync/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/storagesync/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/__init__.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/__init__.py index ab897e67abbf..67e510c0757c 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/__init__.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['MicrosoftStorageSync'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_configuration.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_configuration.py index cca075a91e7c..52f77b8e1fe5 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_configuration.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class MicrosoftStorageSyncConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(MicrosoftStorageSyncConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(MicrosoftStorageSyncConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_metadata.json b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_metadata.json index 36d5a7c7db39..9939477bdff0 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_metadata.json +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_metadata.json @@ -5,13 +5,13 @@ "name": "MicrosoftStorageSync", "filename": "_microsoft_storage_sync", "description": "Microsoft Storage Sync Service API.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MicrosoftStorageSyncConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MicrosoftStorageSyncConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MicrosoftStorageSyncConfiguration\"], \"._operations_mixin\": [\"MicrosoftStorageSyncOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MicrosoftStorageSyncConfiguration\"], \"._operations_mixin\": [\"MicrosoftStorageSyncOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", @@ -110,9 +109,21 @@ "operation_status": "OperationStatusOperations" }, "operation_mixins": { - "sync_imports": "None", - "async_imports": "None", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}", "operations": { + "location_operation_status" : { + "sync": { + "signature": "def location_operation_status(\n self,\n location_name, # type: str\n operation_id, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.LocationOperationStatus\"\n", + "doc": "\"\"\"Get Operation status.\n\n:param location_name: The desired region to obtain information from.\n:type location_name: str\n:param operation_id: operation Id.\n:type operation_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: LocationOperationStatus, or the result of cls(response)\n:rtype: ~azure.mgmt.storagesync.models.LocationOperationStatus\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def location_operation_status(\n self,\n location_name: str,\n operation_id: str,\n **kwargs: Any\n) -\u003e \"_models.LocationOperationStatus\":\n", + "doc": "\"\"\"Get Operation status.\n\n:param location_name: The desired region to obtain information from.\n:type location_name: str\n:param operation_id: operation Id.\n:type operation_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: LocationOperationStatus, or the result of cls(response)\n:rtype: ~azure.mgmt.storagesync.models.LocationOperationStatus\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "location_name, operation_id" + } } } } \ No newline at end of file diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_microsoft_storage_sync.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_microsoft_storage_sync.py index ac8ce46c988a..a99ec3f6e172 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_microsoft_storage_sync.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_microsoft_storage_sync.py @@ -6,32 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import MicrosoftStorageSyncConfiguration +from .operations import CloudEndpointsOperations, MicrosoftStorageSyncOperationsMixin, OperationStatusOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RegisteredServersOperations, ServerEndpointsOperations, StorageSyncServicesOperations, SyncGroupsOperations, WorkflowsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential -from ._configuration import MicrosoftStorageSyncConfiguration -from .operations import Operations -from .operations import StorageSyncServicesOperations -from .operations import PrivateLinkResourcesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import SyncGroupsOperations -from .operations import CloudEndpointsOperations -from .operations import ServerEndpointsOperations -from .operations import RegisteredServersOperations -from .operations import WorkflowsOperations -from .operations import OperationStatusOperations -from . import models - - -class MicrosoftStorageSync(object): +class MicrosoftStorageSync(MicrosoftStorageSyncOperationsMixin): """Microsoft Storage Sync Service API. :ivar operations: Operations operations @@ -39,9 +29,11 @@ class MicrosoftStorageSync(object): :ivar storage_sync_services: StorageSyncServicesOperations operations :vartype storage_sync_services: azure.mgmt.storagesync.operations.StorageSyncServicesOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.storagesync.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.storagesync.operations.PrivateLinkResourcesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.storagesync.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.storagesync.operations.PrivateEndpointConnectionsOperations :ivar sync_groups: SyncGroupsOperations operations :vartype sync_groups: azure.mgmt.storagesync.operations.SyncGroupsOperations :ivar cloud_endpoints: CloudEndpointsOperations operations @@ -58,48 +50,63 @@ class MicrosoftStorageSync(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = MicrosoftStorageSyncConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = MicrosoftStorageSyncConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.storage_sync_services = StorageSyncServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sync_groups = SyncGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_endpoints = CloudEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.server_endpoints = ServerEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.registered_servers = RegisteredServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.workflows = WorkflowsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_sync_services = StorageSyncServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sync_groups = SyncGroupsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cloud_endpoints = CloudEndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.server_endpoints = ServerEndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.registered_servers = RegisteredServersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workflows = WorkflowsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_patch.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_vendor.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_version.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_version.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/__init__.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/__init__.py index 39f85d7fea65..04c6eb9ff13b 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/__init__.py @@ -8,3 +8,8 @@ from ._microsoft_storage_sync import MicrosoftStorageSync __all__ = ['MicrosoftStorageSync'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_configuration.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_configuration.py index 957ea3aa5c02..093beb85446c 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(MicrosoftStorageSyncConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(MicrosoftStorageSyncConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_microsoft_storage_sync.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_microsoft_storage_sync.py index a1ccac388fd9..a7bbb44e815c 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_microsoft_storage_sync.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_microsoft_storage_sync.py @@ -6,40 +6,35 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import MicrosoftStorageSyncConfiguration +from .operations import CloudEndpointsOperations, MicrosoftStorageSyncOperationsMixin, OperationStatusOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RegisteredServersOperations, ServerEndpointsOperations, StorageSyncServicesOperations, SyncGroupsOperations, WorkflowsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MicrosoftStorageSyncConfiguration -from .operations import Operations -from .operations import StorageSyncServicesOperations -from .operations import PrivateLinkResourcesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import SyncGroupsOperations -from .operations import CloudEndpointsOperations -from .operations import ServerEndpointsOperations -from .operations import RegisteredServersOperations -from .operations import WorkflowsOperations -from .operations import OperationStatusOperations -from .. import models - - -class MicrosoftStorageSync(object): +class MicrosoftStorageSync(MicrosoftStorageSyncOperationsMixin): """Microsoft Storage Sync Service API. :ivar operations: Operations operations :vartype operations: azure.mgmt.storagesync.aio.operations.Operations :ivar storage_sync_services: StorageSyncServicesOperations operations - :vartype storage_sync_services: azure.mgmt.storagesync.aio.operations.StorageSyncServicesOperations + :vartype storage_sync_services: + azure.mgmt.storagesync.aio.operations.StorageSyncServicesOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.storagesync.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.storagesync.aio.operations.PrivateLinkResourcesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.storagesync.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.storagesync.aio.operations.PrivateEndpointConnectionsOperations :ivar sync_groups: SyncGroupsOperations operations :vartype sync_groups: azure.mgmt.storagesync.aio.operations.SyncGroupsOperations :ivar cloud_endpoints: CloudEndpointsOperations operations @@ -56,47 +51,63 @@ class MicrosoftStorageSync(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = MicrosoftStorageSyncConfiguration(credential, subscription_id, **kwargs) + self._config = MicrosoftStorageSyncConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.storage_sync_services = StorageSyncServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sync_groups = SyncGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_endpoints = CloudEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.server_endpoints = ServerEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.registered_servers = RegisteredServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.workflows = WorkflowsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_sync_services = StorageSyncServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sync_groups = SyncGroupsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cloud_endpoints = CloudEndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.server_endpoints = ServerEndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.registered_servers = RegisteredServersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workflows = WorkflowsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_patch.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/__init__.py index 85ce9379c268..6498106a813e 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/__init__.py @@ -16,6 +16,7 @@ from ._registered_servers_operations import RegisteredServersOperations from ._workflows_operations import WorkflowsOperations from ._operation_status_operations import OperationStatusOperations +from ._microsoft_storage_sync_operations import MicrosoftStorageSyncOperationsMixin __all__ = [ 'Operations', @@ -28,4 +29,5 @@ 'RegisteredServersOperations', 'WorkflowsOperations', 'OperationStatusOperations', + 'MicrosoftStorageSyncOperationsMixin', ] diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_cloud_endpoints_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_cloud_endpoints_operations.py index 29bbd5b3f0b7..38501a3b7c1a 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_cloud_endpoints_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_cloud_endpoints_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cloud_endpoints_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_sync_group_request, build_post_backup_request_initial, build_post_restore_request_initial, build_pre_backup_request_initial, build_pre_restore_request_initial, build_restoreheartbeat_request, build_trigger_change_detection_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -50,54 +55,44 @@ async def _create_initial( sync_group_name: str, cloud_endpoint_name: str, parameters: "_models.CloudEndpointCreateParameters", - **kwargs + **kwargs: Any ) -> Optional["_models.CloudEndpoint"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CloudEndpoint"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CloudEndpointCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CloudEndpointCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('CloudEndpoint', pipeline_response) if response.status_code == 202: @@ -106,13 +101,17 @@ async def _create_initial( response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -120,7 +119,7 @@ async def begin_create( sync_group_name: str, cloud_endpoint_name: str, parameters: "_models.CloudEndpointCreateParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.CloudEndpoint"]: """Create a new CloudEndpoint. @@ -136,15 +135,19 @@ async def begin_create( :type parameters: ~azure.mgmt.storagesync.models.CloudEndpointCreateParameters :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CloudEndpoint or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CloudEndpoint or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.CloudEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -158,33 +161,25 @@ async def begin_create( sync_group_name=sync_group_name, cloud_endpoint_name=cloud_endpoint_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('CloudEndpoint', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -196,15 +191,17 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, cloud_endpoint_name: str, - **kwargs + **kwargs: Any ) -> "_models.CloudEndpoint": """Get a given CloudEndpoint. @@ -226,96 +223,79 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('CloudEndpoint', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, cloud_endpoint_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if response.status_code == 202: response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) @@ -323,19 +303,22 @@ async def _delete_initial( response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, cloud_endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Delete a given CloudEndpoint. @@ -349,15 +332,17 @@ async def begin_delete( :type cloud_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -373,23 +358,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -401,14 +377,16 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} # type: ignore + @distributed_trace def list_by_sync_group( self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.CloudEndpointArray"]: """Get a CloudEndpoint List. @@ -420,7 +398,8 @@ def list_by_sync_group( :type sync_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CloudEndpointArray or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.CloudEndpointArray] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.CloudEndpointArray] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudEndpointArray"] @@ -428,37 +407,35 @@ def list_by_sync_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_sync_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_sync_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + template_url=self.list_by_sync_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_sync_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CloudEndpointArray', pipeline_response) + deserialized = self._deserialize("CloudEndpointArray", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -471,12 +448,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -489,65 +467,58 @@ async def _pre_backup_initial( sync_group_name: str, cloud_endpoint_name: str, parameters: "_models.BackupRequest", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._pre_backup_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BackupRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_pre_backup_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._pre_backup_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BackupRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _pre_backup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prebackup'} # type: ignore + + @distributed_trace_async async def begin_pre_backup( self, resource_group_name: str, @@ -555,7 +526,7 @@ async def begin_pre_backup( sync_group_name: str, cloud_endpoint_name: str, parameters: "_models.BackupRequest", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Pre Backup a given CloudEndpoint. @@ -571,15 +542,18 @@ async def begin_pre_backup( :type parameters: ~azure.mgmt.storagesync.models.BackupRequest :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -593,26 +567,18 @@ async def begin_pre_backup( sync_group_name=sync_group_name, cloud_endpoint_name=cloud_endpoint_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -624,6 +590,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_pre_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prebackup'} # type: ignore async def _post_backup_initial( @@ -633,68 +600,62 @@ async def _post_backup_initial( sync_group_name: str, cloud_endpoint_name: str, parameters: "_models.BackupRequest", - **kwargs + **kwargs: Any ) -> Optional["_models.PostBackupResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PostBackupResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._post_backup_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BackupRequest') + + request = build_post_backup_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._post_backup_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BackupRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('PostBackupResponse', pipeline_response) if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _post_backup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postbackup'} # type: ignore + + @distributed_trace_async async def begin_post_backup( self, resource_group_name: str, @@ -702,7 +663,7 @@ async def begin_post_backup( sync_group_name: str, cloud_endpoint_name: str, parameters: "_models.BackupRequest", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.PostBackupResponse"]: """Post Backup a given CloudEndpoint. @@ -718,15 +679,19 @@ async def begin_post_backup( :type parameters: ~azure.mgmt.storagesync.models.BackupRequest :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PostBackupResponse or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PostBackupResponse or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.PostBackupResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PostBackupResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -740,12 +705,11 @@ async def begin_post_backup( sync_group_name=sync_group_name, cloud_endpoint_name=cloud_endpoint_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} @@ -753,21 +717,14 @@ def get_long_running_output(pipeline_response): response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('PostBackupResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -779,6 +736,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postbackup'} # type: ignore async def _pre_restore_initial( @@ -788,60 +746,52 @@ async def _pre_restore_initial( sync_group_name: str, cloud_endpoint_name: str, parameters: "_models.PreRestoreRequest", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._pre_restore_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PreRestoreRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_pre_restore_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._pre_restore_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PreRestoreRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _pre_restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prerestore'} # type: ignore + + @distributed_trace_async async def begin_pre_restore( self, resource_group_name: str, @@ -849,7 +799,7 @@ async def begin_pre_restore( sync_group_name: str, cloud_endpoint_name: str, parameters: "_models.PreRestoreRequest", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Pre Restore a given CloudEndpoint. @@ -865,15 +815,18 @@ async def begin_pre_restore( :type parameters: ~azure.mgmt.storagesync.models.PreRestoreRequest :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -887,26 +840,18 @@ async def begin_pre_restore( sync_group_name=sync_group_name, cloud_endpoint_name=cloud_endpoint_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -918,15 +863,17 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_pre_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prerestore'} # type: ignore + @distributed_trace_async async def restoreheartbeat( self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, cloud_endpoint_name: str, - **kwargs + **kwargs: Any ) -> None: """Restore Heartbeat a given CloudEndpoint. @@ -948,46 +895,38 @@ async def restoreheartbeat( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.restoreheartbeat.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_restoreheartbeat_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + template_url=self.restoreheartbeat.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) restoreheartbeat.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/restoreheartbeat'} # type: ignore + async def _post_restore_initial( self, resource_group_name: str, @@ -995,60 +934,52 @@ async def _post_restore_initial( sync_group_name: str, cloud_endpoint_name: str, parameters: "_models.PostRestoreRequest", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._post_restore_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PostRestoreRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_post_restore_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._post_restore_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PostRestoreRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _post_restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postrestore'} # type: ignore + + @distributed_trace_async async def begin_post_restore( self, resource_group_name: str, @@ -1056,7 +987,7 @@ async def begin_post_restore( sync_group_name: str, cloud_endpoint_name: str, parameters: "_models.PostRestoreRequest", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Post Restore a given CloudEndpoint. @@ -1072,15 +1003,18 @@ async def begin_post_restore( :type parameters: ~azure.mgmt.storagesync.models.PostRestoreRequest :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1094,26 +1028,18 @@ async def begin_post_restore( sync_group_name=sync_group_name, cloud_endpoint_name=cloud_endpoint_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1125,6 +1051,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postrestore'} # type: ignore async def _trigger_change_detection_initial( @@ -1134,60 +1061,52 @@ async def _trigger_change_detection_initial( sync_group_name: str, cloud_endpoint_name: str, parameters: "_models.TriggerChangeDetectionParameters", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._trigger_change_detection_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'TriggerChangeDetectionParameters') + + request = build_trigger_change_detection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._trigger_change_detection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TriggerChangeDetectionParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _trigger_change_detection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/triggerChangeDetection'} # type: ignore + + @distributed_trace_async async def begin_trigger_change_detection( self, resource_group_name: str, @@ -1195,7 +1114,7 @@ async def begin_trigger_change_detection( sync_group_name: str, cloud_endpoint_name: str, parameters: "_models.TriggerChangeDetectionParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Triggers detection of changes performed on Azure File share connected to the specified Azure File Sync Cloud Endpoint. @@ -1212,15 +1131,18 @@ async def begin_trigger_change_detection( :type parameters: ~azure.mgmt.storagesync.models.TriggerChangeDetectionParameters :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1234,26 +1156,18 @@ async def begin_trigger_change_detection( sync_group_name=sync_group_name, cloud_endpoint_name=cloud_endpoint_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1265,4 +1179,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_trigger_change_detection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/triggerChangeDetection'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_microsoft_storage_sync_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_microsoft_storage_sync_operations.py new file mode 100644 index 000000000000..ab307c86bdfb --- /dev/null +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_microsoft_storage_sync_operations.py @@ -0,0 +1,81 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._microsoft_storage_sync_operations import build_location_operation_status_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MicrosoftStorageSyncOperationsMixin: + + @distributed_trace_async + async def location_operation_status( + self, + location_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.LocationOperationStatus": + """Get Operation status. + + :param location_name: The desired region to obtain information from. + :type location_name: str + :param operation_id: operation Id. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LocationOperationStatus, or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.LocationOperationStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocationOperationStatus"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_location_operation_status_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + operation_id=operation_id, + template_url=self.location_operation_status.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + deserialized = self._deserialize('LocationOperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + location_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/operations/{operationId}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_operation_status_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_operation_status_operations.py index 766180d609eb..255a424b7873 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_operation_status_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_operation_status_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operation_status_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,13 +44,14 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, location_name: str, workflow_id: str, operation_id: str, - **kwargs + **kwargs: Any ) -> "_models.OperationStatus": """Get Operation status. @@ -68,44 +73,37 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'workflowId': self._serialize.url("workflow_id", workflow_id, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + location_name=location_name, + workflow_id=workflow_id, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('OperationStatus', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/locations/{locationName}/workflows/{workflowId}/operations/{operationId}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_operations.py index 05219f72b2bb..bcb8f8321e81 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,15 +46,18 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationEntityListResult"]: """Lists all of the available Storage Sync Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationEntityListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.OperationEntityListResult] + :return: An iterator like instance of either OperationEntityListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.OperationEntityListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationEntityListResult"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationEntityListResult', pipeline_response) + deserialized = self._deserialize("OperationEntityListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +98,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_private_endpoint_connections_operations.py index fb7a4db315dc..9e250ff5865c 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_private_endpoint_connections_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_storage_sync_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, storage_sync_service_name: str, private_endpoint_connection_name: str, - **kwargs + **kwargs: Any ) -> "_models.PrivateEndpointConnection": """Gets the specified private endpoint connection associated with the storage sync service. @@ -70,34 +76,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -106,58 +102,49 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, storage_sync_service_name: str, private_endpoint_connection_name: str, properties: "_models.PrivateEndpointConnection", - **kwargs + **kwargs: Any ) -> Optional["_models.PrivateEndpointConnection"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -167,20 +154,24 @@ async def _create_initial( response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, storage_sync_service_name: str, private_endpoint_connection_name: str, properties: "_models.PrivateEndpointConnection", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: """Update the state of specified private endpoint connection associated with the storage sync service. @@ -197,15 +188,20 @@ async def begin_create( :type properties: ~azure.mgmt.storagesync.models.PrivateEndpointConnection :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :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 PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -218,28 +214,21 @@ async def begin_create( storage_sync_service_name=storage_sync_service_name, private_endpoint_connection_name=private_endpoint_connection_name, properties=properties, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -251,6 +240,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore async def _delete_initial( @@ -258,42 +248,31 @@ async def _delete_initial( resource_group_name: str, storage_sync_service_name: str, private_endpoint_connection_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: @@ -302,18 +281,21 @@ async def _delete_initial( response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, storage_sync_service_name: str, private_endpoint_connection_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the specified private endpoint connection associated with the storage sync service. @@ -327,15 +309,17 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -350,22 +334,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -377,13 +353,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list_by_storage_sync_service( self, resource_group_name: str, storage_sync_service_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: """Get a PrivateEndpointConnection List. @@ -392,8 +370,10 @@ def list_by_storage_sync_service( :param storage_sync_service_name: Name of Storage Sync Service resource. :type storage_sync_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -401,36 +381,33 @@ def list_by_storage_sync_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_storage_sync_service.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_sync_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + template_url=self.list_by_storage_sync_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_sync_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -443,12 +420,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_private_link_resources_operations.py index fa7418f3bcdb..21463e2408c6 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_private_link_resources_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_link_resources_operations import build_list_by_storage_sync_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,11 +44,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_storage_sync_service( self, resource_group_name: str, storage_sync_service_name: str, - **kwargs + **kwargs: Any ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources that need to be created for a storage sync service. @@ -63,27 +68,17 @@ async def list_by_storage_sync_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.list_by_storage_sync_service.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_storage_sync_service_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_storage_sync_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -97,4 +92,6 @@ async def list_by_storage_sync_service( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateLinkResources'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_registered_servers_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_registered_servers_operations.py index 22e0ef2f0868..1e4a5d0fef22 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_registered_servers_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_registered_servers_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._registered_servers_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_storage_sync_service_request, build_trigger_rollover_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_sync_service( self, resource_group_name: str, storage_sync_service_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RegisteredServerArray"]: """Get a given registered server list. @@ -56,8 +62,10 @@ def list_by_storage_sync_service( :param storage_sync_service_name: Name of Storage Sync Service resource. :type storage_sync_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RegisteredServerArray or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.RegisteredServerArray] + :return: An iterator like instance of either RegisteredServerArray or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.RegisteredServerArray] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegisteredServerArray"] @@ -65,36 +73,33 @@ def list_by_storage_sync_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_storage_sync_service.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_sync_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + template_url=self.list_by_storage_sync_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_sync_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RegisteredServerArray', pipeline_response) + deserialized = self._deserialize("RegisteredServerArray", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,23 +112,25 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, storage_sync_service_name: str, server_id: str, - **kwargs + **kwargs: Any ) -> "_models.RegisteredServer": """Get a given registered server. @@ -143,100 +150,83 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('RegisteredServer', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} # type: ignore + async def _create_initial( self, resource_group_name: str, storage_sync_service_name: str, server_id: str, parameters: "_models.RegisteredServerCreateParameters", - **kwargs + **kwargs: Any ) -> Optional["_models.RegisteredServer"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RegisteredServer"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RegisteredServerCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RegisteredServerCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('RegisteredServer', pipeline_response) if response.status_code == 202: @@ -244,20 +234,24 @@ async def _create_initial( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, storage_sync_service_name: str, server_id: str, parameters: "_models.RegisteredServerCreateParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.RegisteredServer"]: """Add a new registered server. @@ -271,15 +265,19 @@ async def begin_create( :type parameters: ~azure.mgmt.storagesync.models.RegisteredServerCreateParameters :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RegisteredServer or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RegisteredServer or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.RegisteredServer] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RegisteredServer"] lro_delay = kwargs.pop( 'polling_interval', @@ -292,32 +290,25 @@ async def begin_create( storage_sync_service_name=storage_sync_service_name, server_id=server_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('RegisteredServer', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -329,6 +320,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} # type: ignore async def _delete_initial( @@ -336,64 +328,57 @@ async def _delete_initial( resource_group_name: str, storage_sync_service_name: str, server_id: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, storage_sync_service_name: str, server_id: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Delete the given registered server. @@ -405,15 +390,17 @@ async def begin_delete( :type server_id: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -428,22 +415,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -455,6 +434,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} # type: ignore async def _trigger_rollover_initial( @@ -463,70 +443,63 @@ async def _trigger_rollover_initial( storage_sync_service_name: str, server_id: str, parameters: "_models.TriggerRolloverRequest", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._trigger_rollover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'TriggerRolloverRequest') + + request = build_trigger_rollover_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + content_type=content_type, + json=_json, + template_url=self._trigger_rollover_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TriggerRolloverRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _trigger_rollover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}/triggerRollover'} # type: ignore + + @distributed_trace_async async def begin_trigger_rollover( self, resource_group_name: str, storage_sync_service_name: str, server_id: str, parameters: "_models.TriggerRolloverRequest", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Triggers Server certificate rollover. @@ -540,15 +513,18 @@ async def begin_trigger_rollover( :type parameters: ~azure.mgmt.storagesync.models.TriggerRolloverRequest :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -561,25 +537,18 @@ async def begin_trigger_rollover( storage_sync_service_name=storage_sync_service_name, server_id=server_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -591,4 +560,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_trigger_rollover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}/triggerRollover'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_server_endpoints_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_server_endpoints_operations.py index cd0a36ab3a29..06cdbfa62507 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_server_endpoints_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_server_endpoints_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._server_endpoints_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_sync_group_request, build_recall_action_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -50,54 +55,44 @@ async def _create_initial( sync_group_name: str, server_endpoint_name: str, parameters: "_models.ServerEndpointCreateParameters", - **kwargs + **kwargs: Any ) -> Optional["_models.ServerEndpoint"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ServerEndpoint"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServerEndpointCreateParameters') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServerEndpointCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('ServerEndpoint', pipeline_response) if response.status_code == 202: @@ -105,13 +100,17 @@ async def _create_initial( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -119,7 +118,7 @@ async def begin_create( sync_group_name: str, server_endpoint_name: str, parameters: "_models.ServerEndpointCreateParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.ServerEndpoint"]: """Create a new ServerEndpoint. @@ -135,15 +134,19 @@ async def begin_create( :type parameters: ~azure.mgmt.storagesync.models.ServerEndpointCreateParameters :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServerEndpoint or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServerEndpoint or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -157,33 +160,25 @@ async def begin_create( sync_group_name=sync_group_name, server_endpoint_name=server_endpoint_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('ServerEndpoint', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -195,6 +190,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} # type: ignore async def _update_initial( @@ -204,57 +200,47 @@ async def _update_initial( sync_group_name: str, server_endpoint_name: str, parameters: Optional["_models.ServerEndpointUpdateParameters"] = None, - **kwargs + **kwargs: Any ) -> Optional["_models.ServerEndpoint"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ServerEndpoint"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ServerEndpointUpdateParameters') + _json = self._serialize.body(parameters, 'ServerEndpointUpdateParameters') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('ServerEndpoint', pipeline_response) if response.status_code == 202: @@ -262,13 +248,17 @@ async def _update_initial( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -276,7 +266,7 @@ async def begin_update( sync_group_name: str, server_endpoint_name: str, parameters: Optional["_models.ServerEndpointUpdateParameters"] = None, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.ServerEndpoint"]: """Patch a given ServerEndpoint. @@ -292,15 +282,19 @@ async def begin_update( :type parameters: ~azure.mgmt.storagesync.models.ServerEndpointUpdateParameters :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServerEndpoint or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServerEndpoint or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -314,33 +308,25 @@ async def begin_update( sync_group_name=sync_group_name, server_endpoint_name=server_endpoint_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('ServerEndpoint', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -352,15 +338,17 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, server_endpoint_name: str, - **kwargs + **kwargs: Any ) -> "_models.ServerEndpoint": """Get a ServerEndpoint. @@ -382,114 +370,100 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('ServerEndpoint', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, server_endpoint_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, server_endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Delete a given ServerEndpoint. @@ -503,15 +477,17 @@ async def begin_delete( :type server_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -527,23 +503,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -555,14 +522,16 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} # type: ignore + @distributed_trace def list_by_sync_group( self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ServerEndpointArray"]: """Get a ServerEndpoint list. @@ -574,7 +543,8 @@ def list_by_sync_group( :type sync_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServerEndpointArray or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.ServerEndpointArray] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.ServerEndpointArray] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerEndpointArray"] @@ -582,37 +552,35 @@ def list_by_sync_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_sync_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_sync_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + template_url=self.list_by_sync_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_sync_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServerEndpointArray', pipeline_response) + deserialized = self._deserialize("ServerEndpointArray", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -625,12 +593,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -643,64 +612,57 @@ async def _recall_action_initial( sync_group_name: str, server_endpoint_name: str, parameters: "_models.RecallActionParameters", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._recall_action_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RecallActionParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_recall_action_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._recall_action_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RecallActionParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _recall_action_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}/recallAction'} # type: ignore + + @distributed_trace_async async def begin_recall_action( self, resource_group_name: str, @@ -708,7 +670,7 @@ async def begin_recall_action( sync_group_name: str, server_endpoint_name: str, parameters: "_models.RecallActionParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Recall a server endpoint. @@ -724,15 +686,18 @@ async def begin_recall_action( :type parameters: ~azure.mgmt.storagesync.models.RecallActionParameters :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -746,26 +711,18 @@ async def begin_recall_action( sync_group_name=sync_group_name, server_endpoint_name=server_endpoint_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -777,4 +734,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_recall_action.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}/recallAction'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_storage_sync_services_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_storage_sync_services_operations.py index 2dbaf232cd01..a3c2acab6fb4 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_storage_sync_services_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_storage_sync_services_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._storage_sync_services_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, location_name: str, parameters: "_models.CheckNameAvailabilityParameters", - **kwargs + **kwargs: Any ) -> "_models.CheckNameAvailabilityResult": """Check the give namespace name availability. @@ -65,31 +71,21 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + location_name=location_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') - 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 @@ -103,56 +99,47 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability'} # type: ignore + async def _create_initial( self, resource_group_name: str, storage_sync_service_name: str, parameters: "_models.StorageSyncServiceCreateParameters", - **kwargs + **kwargs: Any ) -> Optional["_models.StorageSyncService"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageSyncService"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageSyncServiceCreateParameters') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageSyncServiceCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('StorageSyncService', pipeline_response) @@ -162,19 +149,23 @@ async def _create_initial( response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, storage_sync_service_name: str, parameters: "_models.StorageSyncServiceCreateParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.StorageSyncService"]: """Create a new StorageSyncService. @@ -186,15 +177,19 @@ async def begin_create( :type parameters: ~azure.mgmt.storagesync.models.StorageSyncServiceCreateParameters :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageSyncService or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageSyncService or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.StorageSyncService] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSyncService"] lro_delay = kwargs.pop( 'polling_interval', @@ -206,27 +201,21 @@ async def begin_create( resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageSyncService', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -238,13 +227,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, storage_sync_service_name: str, - **kwargs + **kwargs: Any ) -> "_models.StorageSyncService": """Get a given StorageSyncService. @@ -262,100 +253,83 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('StorageSyncService', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore + async def _update_initial( self, resource_group_name: str, storage_sync_service_name: str, parameters: Optional["_models.StorageSyncServiceUpdateParameters"] = None, - **kwargs + **kwargs: Any ) -> Optional["_models.StorageSyncService"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageSyncService"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'StorageSyncServiceUpdateParameters') + _json = self._serialize.body(parameters, 'StorageSyncServiceUpdateParameters') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('StorageSyncService', pipeline_response) if response.status_code == 202: @@ -364,19 +338,23 @@ async def _update_initial( response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, storage_sync_service_name: str, parameters: Optional["_models.StorageSyncServiceUpdateParameters"] = None, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.StorageSyncService"]: """Patch a given StorageSyncService. @@ -388,15 +366,19 @@ async def begin_update( :type parameters: ~azure.mgmt.storagesync.models.StorageSyncServiceUpdateParameters :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageSyncService or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageSyncService or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.StorageSyncService] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSyncService"] lro_delay = kwargs.pop( 'polling_interval', @@ -408,31 +390,25 @@ async def begin_update( resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('StorageSyncService', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -444,52 +420,43 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore async def _delete_initial( self, resource_group_name: str, storage_sync_service_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if response.status_code == 202: response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) @@ -497,17 +464,20 @@ async def _delete_initial( response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, storage_sync_service_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Delete a given StorageSyncService. @@ -517,15 +487,17 @@ async def begin_delete( :type storage_sync_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -539,21 +511,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -565,20 +530,24 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.StorageSyncServiceArray"]: """Get a StorageSyncService list by Resource group name. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSyncServiceArray or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.StorageSyncServiceArray] + :return: An iterator like instance of either StorageSyncServiceArray or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.StorageSyncServiceArray] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSyncServiceArray"] @@ -586,35 +555,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageSyncServiceArray', pipeline_response) + deserialized = self._deserialize("StorageSyncServiceArray", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -627,26 +592,30 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices'} # type: ignore + @distributed_trace def list_by_subscription( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.StorageSyncServiceArray"]: """Get a StorageSyncService list by subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSyncServiceArray or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.StorageSyncServiceArray] + :return: An iterator like instance of either StorageSyncServiceArray or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.StorageSyncServiceArray] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSyncServiceArray"] @@ -654,34 +623,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageSyncServiceArray', pipeline_response) + deserialized = self._deserialize("StorageSyncServiceArray", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -694,12 +658,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_sync_groups_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_sync_groups_operations.py index 34246f413920..061221542caf 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_sync_groups_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_sync_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sync_groups_operations import build_create_request, build_delete_request, build_get_request, build_list_by_storage_sync_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_sync_service( self, resource_group_name: str, storage_sync_service_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.SyncGroupArray"]: """Get a SyncGroup List. @@ -63,36 +69,33 @@ def list_by_storage_sync_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_storage_sync_service.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_sync_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + template_url=self.list_by_storage_sync_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_sync_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SyncGroupArray', pipeline_response) + deserialized = self._deserialize("SyncGroupArray", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,24 +108,26 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups'} # type: ignore + @distributed_trace_async async def create( self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, parameters: "_models.SyncGroupCreateParameters", - **kwargs + **kwargs: Any ) -> "_models.SyncGroup": """Create a new SyncGroup. @@ -144,58 +149,52 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'SyncGroupCreateParameters') + + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SyncGroupCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('SyncGroup', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.SyncGroup": """Get a given SyncGroup. @@ -215,53 +214,47 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('SyncGroup', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, - **kwargs + **kwargs: Any ) -> None: """Delete a given SyncGroup. @@ -281,42 +274,34 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_workflows_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_workflows_operations.py index 556af5ef9f30..0fb297a1dc38 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_workflows_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_workflows_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._workflows_operations import build_abort_request, build_get_request, build_list_by_storage_sync_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_sync_service( self, resource_group_name: str, storage_sync_service_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.WorkflowArray"]: """Get a Workflow List. @@ -63,36 +69,33 @@ def list_by_storage_sync_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_storage_sync_service.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_sync_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + template_url=self.list_by_storage_sync_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_sync_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WorkflowArray', pipeline_response) + deserialized = self._deserialize("WorkflowArray", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,23 +108,25 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, storage_sync_service_name: str, workflow_id: str, - **kwargs + **kwargs: Any ) -> "_models.Workflow": """Get Workflows resource. @@ -141,53 +146,47 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'workflowId': self._serialize.url("workflow_id", workflow_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + workflow_id=workflow_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('Workflow', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}'} # type: ignore + + @distributed_trace_async async def abort( self, resource_group_name: str, storage_sync_service_name: str, workflow_id: str, - **kwargs + **kwargs: Any ) -> None: """Abort the given workflow. @@ -207,41 +206,33 @@ async def abort( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.abort.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'workflowId': self._serialize.url("workflow_id", workflow_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_abort_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + workflow_id=workflow_id, + template_url=self.abort.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) abort.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}/abort'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/__init__.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/__init__.py index 78d2687ac751..52a96dc2db07 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/__init__.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/__init__.py @@ -6,148 +6,89 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import BackupRequest - from ._models_py3 import CheckNameAvailabilityParameters - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CloudEndpoint - from ._models_py3 import CloudEndpointArray - from ._models_py3 import CloudEndpointCreateParameters - from ._models_py3 import CloudTieringCachePerformance - from ._models_py3 import CloudTieringDatePolicyStatus - from ._models_py3 import CloudTieringFilesNotTiering - from ._models_py3 import CloudTieringSpaceSavings - from ._models_py3 import CloudTieringVolumeFreeSpacePolicyStatus - from ._models_py3 import FilesNotTieringError - from ._models_py3 import OperationDisplayInfo - from ._models_py3 import OperationDisplayResource - from ._models_py3 import OperationEntity - from ._models_py3 import OperationEntityListResult - from ._models_py3 import OperationProperties - from ._models_py3 import OperationResourceMetricSpecification - from ._models_py3 import OperationResourceMetricSpecificationDimension - from ._models_py3 import OperationResourceServiceSpecification - from ._models_py3 import OperationStatus - from ._models_py3 import PostBackupResponse - from ._models_py3 import PostRestoreRequest - from ._models_py3 import PreRestoreRequest - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import ProxyResource - from ._models_py3 import RecallActionParameters - from ._models_py3 import RegisteredServer - from ._models_py3 import RegisteredServerArray - from ._models_py3 import RegisteredServerCreateParameters - from ._models_py3 import Resource - from ._models_py3 import ResourcesMoveInfo - from ._models_py3 import RestoreFileSpec - from ._models_py3 import ServerEndpoint - from ._models_py3 import ServerEndpointArray - from ._models_py3 import ServerEndpointBackgroundDataDownloadActivity - from ._models_py3 import ServerEndpointCloudTieringStatus - from ._models_py3 import ServerEndpointCreateParameters - from ._models_py3 import ServerEndpointFilesNotSyncingError - from ._models_py3 import ServerEndpointRecallError - from ._models_py3 import ServerEndpointRecallStatus - from ._models_py3 import ServerEndpointSyncActivityStatus - from ._models_py3 import ServerEndpointSyncSessionStatus - from ._models_py3 import ServerEndpointSyncStatus - from ._models_py3 import ServerEndpointUpdateParameters - from ._models_py3 import StorageSyncApiError - from ._models_py3 import StorageSyncError - from ._models_py3 import StorageSyncErrorDetails - from ._models_py3 import StorageSyncInnerErrorDetails - from ._models_py3 import StorageSyncService - from ._models_py3 import StorageSyncServiceArray - from ._models_py3 import StorageSyncServiceCreateParameters - from ._models_py3 import StorageSyncServiceUpdateParameters - from ._models_py3 import SubscriptionState - from ._models_py3 import SyncGroup - from ._models_py3 import SyncGroupArray - from ._models_py3 import SyncGroupCreateParameters - from ._models_py3 import TrackedResource - from ._models_py3 import TriggerChangeDetectionParameters - from ._models_py3 import TriggerRolloverRequest - from ._models_py3 import Workflow - from ._models_py3 import WorkflowArray -except (SyntaxError, ImportError): - from ._models import BackupRequest # type: ignore - from ._models import CheckNameAvailabilityParameters # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CloudEndpoint # type: ignore - from ._models import CloudEndpointArray # type: ignore - from ._models import CloudEndpointCreateParameters # type: ignore - from ._models import CloudTieringCachePerformance # type: ignore - from ._models import CloudTieringDatePolicyStatus # type: ignore - from ._models import CloudTieringFilesNotTiering # type: ignore - from ._models import CloudTieringSpaceSavings # type: ignore - from ._models import CloudTieringVolumeFreeSpacePolicyStatus # type: ignore - from ._models import FilesNotTieringError # type: ignore - from ._models import OperationDisplayInfo # type: ignore - from ._models import OperationDisplayResource # type: ignore - from ._models import OperationEntity # type: ignore - from ._models import OperationEntityListResult # type: ignore - from ._models import OperationProperties # type: ignore - from ._models import OperationResourceMetricSpecification # type: ignore - from ._models import OperationResourceMetricSpecificationDimension # type: ignore - from ._models import OperationResourceServiceSpecification # type: ignore - from ._models import OperationStatus # type: ignore - from ._models import PostBackupResponse # type: ignore - from ._models import PostRestoreRequest # type: ignore - from ._models import PreRestoreRequest # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import RecallActionParameters # type: ignore - from ._models import RegisteredServer # type: ignore - from ._models import RegisteredServerArray # type: ignore - from ._models import RegisteredServerCreateParameters # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourcesMoveInfo # type: ignore - from ._models import RestoreFileSpec # type: ignore - from ._models import ServerEndpoint # type: ignore - from ._models import ServerEndpointArray # type: ignore - from ._models import ServerEndpointBackgroundDataDownloadActivity # type: ignore - from ._models import ServerEndpointCloudTieringStatus # type: ignore - from ._models import ServerEndpointCreateParameters # type: ignore - from ._models import ServerEndpointFilesNotSyncingError # type: ignore - from ._models import ServerEndpointRecallError # type: ignore - from ._models import ServerEndpointRecallStatus # type: ignore - from ._models import ServerEndpointSyncActivityStatus # type: ignore - from ._models import ServerEndpointSyncSessionStatus # type: ignore - from ._models import ServerEndpointSyncStatus # type: ignore - from ._models import ServerEndpointUpdateParameters # type: ignore - from ._models import StorageSyncApiError # type: ignore - from ._models import StorageSyncError # type: ignore - from ._models import StorageSyncErrorDetails # type: ignore - from ._models import StorageSyncInnerErrorDetails # type: ignore - from ._models import StorageSyncService # type: ignore - from ._models import StorageSyncServiceArray # type: ignore - from ._models import StorageSyncServiceCreateParameters # type: ignore - from ._models import StorageSyncServiceUpdateParameters # type: ignore - from ._models import SubscriptionState # type: ignore - from ._models import SyncGroup # type: ignore - from ._models import SyncGroupArray # type: ignore - from ._models import SyncGroupCreateParameters # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import TriggerChangeDetectionParameters # type: ignore - from ._models import TriggerRolloverRequest # type: ignore - from ._models import Workflow # type: ignore - from ._models import WorkflowArray # type: ignore +from ._models_py3 import BackupRequest +from ._models_py3 import CheckNameAvailabilityParameters +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CloudEndpoint +from ._models_py3 import CloudEndpointArray +from ._models_py3 import CloudEndpointChangeEnumerationActivity +from ._models_py3 import CloudEndpointChangeEnumerationStatus +from ._models_py3 import CloudEndpointCreateParameters +from ._models_py3 import CloudEndpointLastChangeEnumerationStatus +from ._models_py3 import CloudTieringCachePerformance +from ._models_py3 import CloudTieringDatePolicyStatus +from ._models_py3 import CloudTieringFilesNotTiering +from ._models_py3 import CloudTieringSpaceSavings +from ._models_py3 import CloudTieringVolumeFreeSpacePolicyStatus +from ._models_py3 import FilesNotTieringError +from ._models_py3 import LocationOperationStatus +from ._models_py3 import OperationDisplayInfo +from ._models_py3 import OperationDisplayResource +from ._models_py3 import OperationEntity +from ._models_py3 import OperationEntityListResult +from ._models_py3 import OperationProperties +from ._models_py3 import OperationResourceMetricSpecification +from ._models_py3 import OperationResourceMetricSpecificationDimension +from ._models_py3 import OperationResourceServiceSpecification +from ._models_py3 import OperationStatus +from ._models_py3 import PostBackupResponse +from ._models_py3 import PostRestoreRequest +from ._models_py3 import PreRestoreRequest +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProxyResource +from ._models_py3 import RecallActionParameters +from ._models_py3 import RegisteredServer +from ._models_py3 import RegisteredServerArray +from ._models_py3 import RegisteredServerCreateParameters +from ._models_py3 import Resource +from ._models_py3 import ResourcesMoveInfo +from ._models_py3 import RestoreFileSpec +from ._models_py3 import ServerEndpoint +from ._models_py3 import ServerEndpointArray +from ._models_py3 import ServerEndpointBackgroundDataDownloadActivity +from ._models_py3 import ServerEndpointCloudTieringStatus +from ._models_py3 import ServerEndpointCreateParameters +from ._models_py3 import ServerEndpointFilesNotSyncingError +from ._models_py3 import ServerEndpointRecallError +from ._models_py3 import ServerEndpointRecallStatus +from ._models_py3 import ServerEndpointSyncActivityStatus +from ._models_py3 import ServerEndpointSyncSessionStatus +from ._models_py3 import ServerEndpointSyncStatus +from ._models_py3 import ServerEndpointUpdateParameters +from ._models_py3 import StorageSyncApiError +from ._models_py3 import StorageSyncError +from ._models_py3 import StorageSyncErrorDetails +from ._models_py3 import StorageSyncInnerErrorDetails +from ._models_py3 import StorageSyncService +from ._models_py3 import StorageSyncServiceArray +from ._models_py3 import StorageSyncServiceCreateParameters +from ._models_py3 import StorageSyncServiceUpdateParameters +from ._models_py3 import SubscriptionState +from ._models_py3 import SyncGroup +from ._models_py3 import SyncGroupArray +from ._models_py3 import SyncGroupCreateParameters +from ._models_py3 import SystemData +from ._models_py3 import TrackedResource +from ._models_py3 import TriggerChangeDetectionParameters +from ._models_py3 import TriggerRolloverRequest +from ._models_py3 import Workflow +from ._models_py3 import WorkflowArray + from ._microsoft_storage_sync_enums import ( ChangeDetectionMode, + CloudEndpointChangeEnumerationActivityState, + CloudEndpointChangeEnumerationTotalCountsState, + CreatedByType, FeatureStatus, IncomingTrafficPolicy, InitialDownloadPolicy, + InitialUploadPolicy, LocalCacheMode, NameAvailabilityReason, OperationDirection, @@ -169,13 +110,17 @@ 'CheckNameAvailabilityResult', 'CloudEndpoint', 'CloudEndpointArray', + 'CloudEndpointChangeEnumerationActivity', + 'CloudEndpointChangeEnumerationStatus', 'CloudEndpointCreateParameters', + 'CloudEndpointLastChangeEnumerationStatus', 'CloudTieringCachePerformance', 'CloudTieringDatePolicyStatus', 'CloudTieringFilesNotTiering', 'CloudTieringSpaceSavings', 'CloudTieringVolumeFreeSpacePolicyStatus', 'FilesNotTieringError', + 'LocationOperationStatus', 'OperationDisplayInfo', 'OperationDisplayResource', 'OperationEntity', @@ -226,15 +171,20 @@ 'SyncGroup', 'SyncGroupArray', 'SyncGroupCreateParameters', + 'SystemData', 'TrackedResource', 'TriggerChangeDetectionParameters', 'TriggerRolloverRequest', 'Workflow', 'WorkflowArray', 'ChangeDetectionMode', + 'CloudEndpointChangeEnumerationActivityState', + 'CloudEndpointChangeEnumerationTotalCountsState', + 'CreatedByType', 'FeatureStatus', 'IncomingTrafficPolicy', 'InitialDownloadPolicy', + 'InitialUploadPolicy', 'LocalCacheMode', 'NameAvailabilityReason', 'OperationDirection', diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_microsoft_storage_sync_enums.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_microsoft_storage_sync_enums.py index 3a002f71150f..fdcd20dca6a1 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_microsoft_storage_sync_enums.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_microsoft_storage_sync_enums.py @@ -6,48 +6,56 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ChangeDetectionMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ChangeDetectionMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Change Detection Mode. Applies to a directory specified in directoryPath parameter. """ DEFAULT = "Default" RECURSIVE = "Recursive" -class FeatureStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CloudEndpointChangeEnumerationActivityState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of change enumeration activity + """ + + INITIAL_ENUMERATION_IN_PROGRESS = "InitialEnumerationInProgress" + ENUMERATION_IN_PROGRESS = "EnumerationInProgress" + +class CloudEndpointChangeEnumerationTotalCountsState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of the total counts of change enumeration activity + """ + + CALCULATING = "Calculating" + FINAL = "Final" + +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class FeatureStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the Feature Status """ ON = "on" OFF = "off" -class IncomingTrafficPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IncomingTrafficPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the Incoming Traffic Policy """ ALLOW_ALL_TRAFFIC = "AllowAllTraffic" ALLOW_VIRTUAL_NETWORKS_ONLY = "AllowVirtualNetworksOnly" -class InitialDownloadPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InitialDownloadPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Policy for how namespace and files are recalled during FastDr """ @@ -55,15 +63,22 @@ class InitialDownloadPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) NAMESPACE_THEN_MODIFIED_FILES = "NamespaceThenModifiedFiles" AVOID_TIERED_FILES = "AvoidTieredFiles" -class LocalCacheMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Policy for enabling follow-the-sun business models: link local cache to cloud behavior to pre- - populate before local access. +class InitialUploadPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Policy for how the initial upload sync session is performed. + """ + + SERVER_AUTHORITATIVE = "ServerAuthoritative" + MERGE = "Merge" + +class LocalCacheMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Policy for enabling follow-the-sun business models: link local cache to cloud behavior to + pre-populate before local access. """ DOWNLOAD_NEW_AND_MODIFIED_FILES = "DownloadNewAndModifiedFiles" UPDATE_LOCALLY_CACHED_FILES = "UpdateLocallyCachedFiles" -class NameAvailabilityReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NameAvailabilityReason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason that a Storage Sync Service name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -71,7 +86,7 @@ class NameAvailabilityReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) INVALID = "Invalid" ALREADY_EXISTS = "AlreadyExists" -class OperationDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperationDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the Operation Direction """ @@ -79,7 +94,7 @@ class OperationDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UNDO = "undo" CANCEL = "cancel" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -88,7 +103,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive DELETING = "Deleting" FAILED = "Failed" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -96,7 +111,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum APPROVED = "Approved" REJECTED = "Rejected" -class ProgressType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProgressType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the ProgressType """ @@ -106,7 +121,7 @@ class ProgressType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPLOAD = "upload" RECALL = "recall" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of Azure Subscription """ @@ -116,7 +131,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUSPENDED = "Suspended" DELETED = "Deleted" -class RegisteredServerAgentVersionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RegisteredServerAgentVersionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the registered server agent version status """ @@ -125,7 +140,7 @@ class RegisteredServerAgentVersionStatus(with_metaclass(_CaseInsensitiveEnumMeta EXPIRED = "Expired" BLOCKED = "Blocked" -class ServerEndpointHealthState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServerEndpointHealthState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the server endpoint health state """ @@ -133,7 +148,7 @@ class ServerEndpointHealthState(with_metaclass(_CaseInsensitiveEnumMeta, str, En HEALTHY = "Healthy" ERROR = "Error" -class ServerEndpointOfflineDataTransferState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServerEndpointOfflineDataTransferState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the Health state """ @@ -142,7 +157,7 @@ class ServerEndpointOfflineDataTransferState(with_metaclass(_CaseInsensitiveEnum NOT_RUNNING = "NotRunning" COMPLETE = "Complete" -class ServerEndpointSyncActivityState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServerEndpointSyncActivityState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the sync activity state """ @@ -150,7 +165,7 @@ class ServerEndpointSyncActivityState(with_metaclass(_CaseInsensitiveEnumMeta, s DOWNLOAD = "Download" UPLOAD_AND_DOWNLOAD = "UploadAndDownload" -class ServerEndpointSyncMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServerEndpointSyncMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Sync mode for the server endpoint. """ @@ -160,7 +175,7 @@ class ServerEndpointSyncMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) SNAPSHOT_UPLOAD = "SnapshotUpload" INITIAL_FULL_DOWNLOAD = "InitialFullDownload" -class WorkflowStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WorkflowStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the Workflow Status """ diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_models.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_models.py deleted file mode 100644 index 0dbfd9dba1aa..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_models.py +++ /dev/null @@ -1,2733 +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 azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class BackupRequest(msrest.serialization.Model): - """Backup request. - - :param azure_file_share: Azure File Share. - :type azure_file_share: str - """ - - _attribute_map = { - 'azure_file_share': {'key': 'azureFileShare', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BackupRequest, self).__init__(**kwargs) - self.azure_file_share = kwargs.get('azure_file_share', None) - - -class CheckNameAvailabilityParameters(msrest.serialization.Model): - """Parameters for a check name availability request. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name to check for availability. - :type name: str - :ivar type: Required. The resource type. Must be set to - Microsoft.StorageSync/storageSyncServices. Default value: - "Microsoft.StorageSync/storageSyncServices". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.StorageSync/storageSyncServices" - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: Gets a boolean value that indicates whether the name is available for you - to use. If true, the name is available. If false, the name has already been taken or invalid - and cannot be used. - :vartype name_available: bool - :ivar reason: Gets the reason that a Storage Sync Service name could not be used. The Reason - element is only returned if NameAvailable is false. Possible values include: "Invalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.storagesync.models.NameAvailabilityReason - :ivar message: Gets an error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class CloudEndpoint(ProxyResource): - """Cloud Endpoint object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param storage_account_resource_id: Storage Account Resource Id. - :type storage_account_resource_id: str - :param azure_file_share_name: Azure file share name. - :type azure_file_share_name: str - :param storage_account_tenant_id: Storage Account Tenant Id. - :type storage_account_tenant_id: str - :param partnership_id: Partnership Id. - :type partnership_id: str - :param friendly_name: Friendly Name. - :type friendly_name: str - :ivar backup_enabled: Backup Enabled. - :vartype backup_enabled: str - :param provisioning_state: CloudEndpoint Provisioning State. - :type provisioning_state: str - :param last_workflow_id: CloudEndpoint lastWorkflowId. - :type last_workflow_id: str - :param last_operation_name: Resource Last Operation Name. - :type last_operation_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'backup_enabled': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, - 'azure_file_share_name': {'key': 'properties.azureFileShareName', 'type': 'str'}, - 'storage_account_tenant_id': {'key': 'properties.storageAccountTenantId', 'type': 'str'}, - 'partnership_id': {'key': 'properties.partnershipId', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'backup_enabled': {'key': 'properties.backupEnabled', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'last_workflow_id': {'key': 'properties.lastWorkflowId', 'type': 'str'}, - 'last_operation_name': {'key': 'properties.lastOperationName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudEndpoint, self).__init__(**kwargs) - self.storage_account_resource_id = kwargs.get('storage_account_resource_id', None) - self.azure_file_share_name = kwargs.get('azure_file_share_name', None) - self.storage_account_tenant_id = kwargs.get('storage_account_tenant_id', None) - self.partnership_id = kwargs.get('partnership_id', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.backup_enabled = None - self.provisioning_state = kwargs.get('provisioning_state', None) - self.last_workflow_id = kwargs.get('last_workflow_id', None) - self.last_operation_name = kwargs.get('last_operation_name', None) - - -class CloudEndpointArray(msrest.serialization.Model): - """Array of CloudEndpoint. - - :param value: Collection of CloudEndpoint. - :type value: list[~azure.mgmt.storagesync.models.CloudEndpoint] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CloudEndpoint]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudEndpointArray, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class CloudEndpointCreateParameters(ProxyResource): - """The parameters used when creating a cloud endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param storage_account_resource_id: Storage Account Resource Id. - :type storage_account_resource_id: str - :param azure_file_share_name: Azure file share name. - :type azure_file_share_name: str - :param storage_account_tenant_id: Storage Account Tenant Id. - :type storage_account_tenant_id: str - :param friendly_name: Friendly Name. - :type friendly_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, - 'azure_file_share_name': {'key': 'properties.azureFileShareName', 'type': 'str'}, - 'storage_account_tenant_id': {'key': 'properties.storageAccountTenantId', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudEndpointCreateParameters, self).__init__(**kwargs) - self.storage_account_resource_id = kwargs.get('storage_account_resource_id', None) - self.azure_file_share_name = kwargs.get('azure_file_share_name', None) - self.storage_account_tenant_id = kwargs.get('storage_account_tenant_id', None) - self.friendly_name = kwargs.get('friendly_name', None) - - -class CloudTieringCachePerformance(msrest.serialization.Model): - """Server endpoint cloud tiering status object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar last_updated_timestamp: Last updated timestamp. - :vartype last_updated_timestamp: ~datetime.datetime - :ivar cache_hit_bytes: Count of bytes that were served from the local server. - :vartype cache_hit_bytes: long - :ivar cache_miss_bytes: Count of bytes that were served from the cloud. - :vartype cache_miss_bytes: long - :ivar cache_hit_bytes_percent: Percentage of total bytes (hit + miss) that were served from the - local server. - :vartype cache_hit_bytes_percent: int - """ - - _validation = { - 'last_updated_timestamp': {'readonly': True}, - 'cache_hit_bytes': {'readonly': True, 'minimum': 0}, - 'cache_miss_bytes': {'readonly': True, 'minimum': 0}, - 'cache_hit_bytes_percent': {'readonly': True, 'maximum': 100, 'minimum': 0}, - } - - _attribute_map = { - 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, - 'cache_hit_bytes': {'key': 'cacheHitBytes', 'type': 'long'}, - 'cache_miss_bytes': {'key': 'cacheMissBytes', 'type': 'long'}, - 'cache_hit_bytes_percent': {'key': 'cacheHitBytesPercent', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudTieringCachePerformance, self).__init__(**kwargs) - self.last_updated_timestamp = None - self.cache_hit_bytes = None - self.cache_miss_bytes = None - self.cache_hit_bytes_percent = None - - -class CloudTieringDatePolicyStatus(msrest.serialization.Model): - """Status of the date policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar last_updated_timestamp: Last updated timestamp. - :vartype last_updated_timestamp: ~datetime.datetime - :ivar tiered_files_most_recent_access_timestamp: Most recent access time of tiered files. - :vartype tiered_files_most_recent_access_timestamp: ~datetime.datetime - """ - - _validation = { - 'last_updated_timestamp': {'readonly': True}, - 'tiered_files_most_recent_access_timestamp': {'readonly': True}, - } - - _attribute_map = { - 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, - 'tiered_files_most_recent_access_timestamp': {'key': 'tieredFilesMostRecentAccessTimestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudTieringDatePolicyStatus, self).__init__(**kwargs) - self.last_updated_timestamp = None - self.tiered_files_most_recent_access_timestamp = None - - -class CloudTieringFilesNotTiering(msrest.serialization.Model): - """Server endpoint cloud tiering status object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar last_updated_timestamp: Last updated timestamp. - :vartype last_updated_timestamp: ~datetime.datetime - :ivar total_file_count: Last cloud tiering result (HResult). - :vartype total_file_count: long - :ivar errors: Array of tiering errors. - :vartype errors: list[~azure.mgmt.storagesync.models.FilesNotTieringError] - """ - - _validation = { - 'last_updated_timestamp': {'readonly': True}, - 'total_file_count': {'readonly': True, 'minimum': 0}, - 'errors': {'readonly': True}, - } - - _attribute_map = { - 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, - 'total_file_count': {'key': 'totalFileCount', 'type': 'long'}, - 'errors': {'key': 'errors', 'type': '[FilesNotTieringError]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudTieringFilesNotTiering, self).__init__(**kwargs) - self.last_updated_timestamp = None - self.total_file_count = None - self.errors = None - - -class CloudTieringSpaceSavings(msrest.serialization.Model): - """Server endpoint cloud tiering status object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar last_updated_timestamp: Last updated timestamp. - :vartype last_updated_timestamp: ~datetime.datetime - :ivar volume_size_bytes: Volume size. - :vartype volume_size_bytes: long - :ivar total_size_cloud_bytes: Total size of content in the azure file share. - :vartype total_size_cloud_bytes: long - :ivar cached_size_bytes: Cached content size on the server. - :vartype cached_size_bytes: long - :ivar space_savings_percent: Percentage of cached size over total size. - :vartype space_savings_percent: int - :ivar space_savings_bytes: Count of bytes saved on the server. - :vartype space_savings_bytes: long - """ - - _validation = { - 'last_updated_timestamp': {'readonly': True}, - 'volume_size_bytes': {'readonly': True, 'minimum': 0}, - 'total_size_cloud_bytes': {'readonly': True, 'minimum': 0}, - 'cached_size_bytes': {'readonly': True, 'minimum': 0}, - 'space_savings_percent': {'readonly': True, 'maximum': 100, 'minimum': 0}, - 'space_savings_bytes': {'readonly': True, 'minimum': 0}, - } - - _attribute_map = { - 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, - 'volume_size_bytes': {'key': 'volumeSizeBytes', 'type': 'long'}, - 'total_size_cloud_bytes': {'key': 'totalSizeCloudBytes', 'type': 'long'}, - 'cached_size_bytes': {'key': 'cachedSizeBytes', 'type': 'long'}, - 'space_savings_percent': {'key': 'spaceSavingsPercent', 'type': 'int'}, - 'space_savings_bytes': {'key': 'spaceSavingsBytes', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudTieringSpaceSavings, self).__init__(**kwargs) - self.last_updated_timestamp = None - self.volume_size_bytes = None - self.total_size_cloud_bytes = None - self.cached_size_bytes = None - self.space_savings_percent = None - self.space_savings_bytes = None - - -class CloudTieringVolumeFreeSpacePolicyStatus(msrest.serialization.Model): - """Status of the volume free space policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar last_updated_timestamp: Last updated timestamp. - :vartype last_updated_timestamp: ~datetime.datetime - :ivar effective_volume_free_space_policy: In the case where multiple server endpoints are - present in a volume, an effective free space policy is applied. - :vartype effective_volume_free_space_policy: int - :ivar current_volume_free_space_percent: Current volume free space percentage. - :vartype current_volume_free_space_percent: int - """ - - _validation = { - 'last_updated_timestamp': {'readonly': True}, - 'effective_volume_free_space_policy': {'readonly': True, 'maximum': 100, 'minimum': 0}, - 'current_volume_free_space_percent': {'readonly': True, 'maximum': 100, 'minimum': 0}, - } - - _attribute_map = { - 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, - 'effective_volume_free_space_policy': {'key': 'effectiveVolumeFreeSpacePolicy', 'type': 'int'}, - 'current_volume_free_space_percent': {'key': 'currentVolumeFreeSpacePercent', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudTieringVolumeFreeSpacePolicyStatus, self).__init__(**kwargs) - self.last_updated_timestamp = None - self.effective_volume_free_space_policy = None - self.current_volume_free_space_percent = None - - -class FilesNotTieringError(msrest.serialization.Model): - """Files not tiering error object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_code: Error code (HResult). - :vartype error_code: int - :ivar file_count: Count of files with this error. - :vartype file_count: long - """ - - _validation = { - 'error_code': {'readonly': True}, - 'file_count': {'readonly': True, 'minimum': 0}, - } - - _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'int'}, - 'file_count': {'key': 'fileCount', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(FilesNotTieringError, self).__init__(**kwargs) - self.error_code = None - self.file_count = None - - -class OperationDisplayInfo(msrest.serialization.Model): - """The operation supported by storage sync. - - :param description: The description of the operation. - :type description: str - :param operation: The action that users can perform, based on their permission level. - :type operation: str - :param provider: Service provider: Microsoft StorageSync. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - """ - - _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplayInfo, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.operation = kwargs.get('operation', None) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - - -class OperationDisplayResource(msrest.serialization.Model): - """Operation Display Resource object. - - :param provider: Operation Display Resource Provider. - :type provider: str - :param resource: Operation Display Resource. - :type resource: str - :param operation: Operation Display Resource Operation. - :type operation: str - :param description: Operation Display Resource Description. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplayResource, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationEntity(msrest.serialization.Model): - """The operation supported by storage sync. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The operation supported by storage sync. - :type display: ~azure.mgmt.storagesync.models.OperationDisplayInfo - :param origin: The origin. - :type origin: str - :param properties: Properties of the operations resource. - :type properties: ~azure.mgmt.storagesync.models.OperationProperties - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplayInfo'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OperationProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationEntity, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.properties = kwargs.get('properties', None) - - -class OperationEntityListResult(msrest.serialization.Model): - """The list of storage sync operations. - - :param next_link: The link used to get the next page of operations. - :type next_link: str - :param value: The list of operations. - :type value: list[~azure.mgmt.storagesync.models.OperationEntity] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[OperationEntity]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationEntityListResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class OperationProperties(msrest.serialization.Model): - """Properties of the operations resource. - - :param service_specification: Service specification for the operations resource. - :type service_specification: - ~azure.mgmt.storagesync.models.OperationResourceServiceSpecification - """ - - _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'OperationResourceServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationProperties, self).__init__(**kwargs) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationResourceMetricSpecification(msrest.serialization.Model): - """Operation Display Resource object. - - :param name: Name of the metric. - :type name: str - :param display_name: Display name for the metric. - :type display_name: str - :param display_description: Display description for the metric. - :type display_description: str - :param unit: Unit for the metric. - :type unit: str - :param aggregation_type: Aggregation type for the metric. - :type aggregation_type: str - :param fill_gap_with_zero: Fill gaps in the metric with zero. - :type fill_gap_with_zero: bool - :param dimensions: Dimensions for the metric specification. - :type dimensions: - list[~azure.mgmt.storagesync.models.OperationResourceMetricSpecificationDimension] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'dimensions': {'key': 'dimensions', 'type': '[OperationResourceMetricSpecificationDimension]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationResourceMetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.dimensions = kwargs.get('dimensions', None) - - -class OperationResourceMetricSpecificationDimension(msrest.serialization.Model): - """OperationResourceMetricSpecificationDimension object. - - :param name: Name of the dimension. - :type name: str - :param display_name: Display name of the dimensions. - :type display_name: str - :param to_be_exported_for_shoebox: Indicates metric should be exported for Shoebox. - :type to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationResourceMetricSpecificationDimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) - - -class OperationResourceServiceSpecification(msrest.serialization.Model): - """Service specification. - - :param metric_specifications: List of metric specifications. - :type metric_specifications: - list[~azure.mgmt.storagesync.models.OperationResourceMetricSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[OperationResourceMetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationResourceServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class OperationStatus(msrest.serialization.Model): - """Operation status object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Operation Id. - :vartype name: str - :ivar status: Operation status. - :vartype status: str - :ivar start_time: Start time of the operation. - :vartype start_time: ~datetime.datetime - :ivar end_time: End time of the operation. - :vartype end_time: ~datetime.datetime - :ivar error: Error details. - :vartype error: ~azure.mgmt.storagesync.models.StorageSyncApiError - """ - - _validation = { - 'name': {'readonly': True}, - 'status': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'error': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'error': {'key': 'error', 'type': 'StorageSyncApiError'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatus, self).__init__(**kwargs) - self.name = None - self.status = None - self.start_time = None - self.end_time = None - self.error = None - - -class PostBackupResponse(msrest.serialization.Model): - """Post Backup Response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cloud_endpoint_name: cloud endpoint Name. - :vartype cloud_endpoint_name: str - """ - - _validation = { - 'cloud_endpoint_name': {'readonly': True}, - } - - _attribute_map = { - 'cloud_endpoint_name': {'key': 'backupMetadata.cloudEndpointName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PostBackupResponse, self).__init__(**kwargs) - self.cloud_endpoint_name = None - - -class PostRestoreRequest(msrest.serialization.Model): - """Post Restore Request. - - :param partition: Post Restore partition. - :type partition: str - :param replica_group: Post Restore replica group. - :type replica_group: str - :param request_id: Post Restore request id. - :type request_id: str - :param azure_file_share_uri: Post Restore Azure file share uri. - :type azure_file_share_uri: str - :param status: Post Restore Azure status. - :type status: str - :param source_azure_file_share_uri: Post Restore Azure source azure file share uri. - :type source_azure_file_share_uri: str - :param failed_file_list: Post Restore Azure failed file list. - :type failed_file_list: str - :param restore_file_spec: Post Restore restore file spec array. - :type restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] - """ - - _attribute_map = { - 'partition': {'key': 'partition', 'type': 'str'}, - 'replica_group': {'key': 'replicaGroup', 'type': 'str'}, - 'request_id': {'key': 'requestId', 'type': 'str'}, - 'azure_file_share_uri': {'key': 'azureFileShareUri', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'source_azure_file_share_uri': {'key': 'sourceAzureFileShareUri', 'type': 'str'}, - 'failed_file_list': {'key': 'failedFileList', 'type': 'str'}, - 'restore_file_spec': {'key': 'restoreFileSpec', 'type': '[RestoreFileSpec]'}, - } - - def __init__( - self, - **kwargs - ): - super(PostRestoreRequest, self).__init__(**kwargs) - self.partition = kwargs.get('partition', None) - self.replica_group = kwargs.get('replica_group', None) - self.request_id = kwargs.get('request_id', None) - self.azure_file_share_uri = kwargs.get('azure_file_share_uri', None) - self.status = kwargs.get('status', None) - self.source_azure_file_share_uri = kwargs.get('source_azure_file_share_uri', None) - self.failed_file_list = kwargs.get('failed_file_list', None) - self.restore_file_spec = kwargs.get('restore_file_spec', None) - - -class PreRestoreRequest(msrest.serialization.Model): - """Pre Restore request object. - - :param partition: Pre Restore partition. - :type partition: str - :param replica_group: Pre Restore replica group. - :type replica_group: str - :param request_id: Pre Restore request id. - :type request_id: str - :param azure_file_share_uri: Pre Restore Azure file share uri. - :type azure_file_share_uri: str - :param status: Pre Restore Azure status. - :type status: str - :param source_azure_file_share_uri: Pre Restore Azure source azure file share uri. - :type source_azure_file_share_uri: str - :param backup_metadata_property_bag: Pre Restore backup metadata property bag. - :type backup_metadata_property_bag: str - :param restore_file_spec: Pre Restore restore file spec array. - :type restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] - :param pause_wait_for_sync_drain_time_period_in_seconds: Pre Restore pause wait for sync drain - time period in seconds. - :type pause_wait_for_sync_drain_time_period_in_seconds: int - """ - - _attribute_map = { - 'partition': {'key': 'partition', 'type': 'str'}, - 'replica_group': {'key': 'replicaGroup', 'type': 'str'}, - 'request_id': {'key': 'requestId', 'type': 'str'}, - 'azure_file_share_uri': {'key': 'azureFileShareUri', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'source_azure_file_share_uri': {'key': 'sourceAzureFileShareUri', 'type': 'str'}, - 'backup_metadata_property_bag': {'key': 'backupMetadataPropertyBag', 'type': 'str'}, - 'restore_file_spec': {'key': 'restoreFileSpec', 'type': '[RestoreFileSpec]'}, - 'pause_wait_for_sync_drain_time_period_in_seconds': {'key': 'pauseWaitForSyncDrainTimePeriodInSeconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(PreRestoreRequest, self).__init__(**kwargs) - self.partition = kwargs.get('partition', None) - self.replica_group = kwargs.get('replica_group', None) - self.request_id = kwargs.get('request_id', None) - self.azure_file_share_uri = kwargs.get('azure_file_share_uri', None) - self.status = kwargs.get('status', None) - self.source_azure_file_share_uri = kwargs.get('source_azure_file_share_uri', None) - self.backup_metadata_property_bag = kwargs.get('backup_metadata_property_bag', None) - self.restore_file_spec = kwargs.get('restore_file_spec', None) - self.pause_wait_for_sync_drain_time_period_in_seconds = kwargs.get('pause_wait_for_sync_drain_time_period_in_seconds', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None - - -class PrivateEndpointConnection(Resource): - """The Private Endpoint Connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.storagesync.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: - ~azure.mgmt.storagesync.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.storagesync.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """List of private endpoint connection associated with the specified storage account. - - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.storagesync.models.PrivateEndpointConnection] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkResource(Resource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private link resources. - :type value: list[~azure.mgmt.storagesync.models.PrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. - - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or ~azure.mgmt.storagesync.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :type actions_required: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class RecallActionParameters(msrest.serialization.Model): - """The parameters used when calling recall action on server endpoint. - - :param pattern: Pattern of the files. - :type pattern: str - :param recall_path: Recall path. - :type recall_path: str - """ - - _attribute_map = { - 'pattern': {'key': 'pattern', 'type': 'str'}, - 'recall_path': {'key': 'recallPath', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecallActionParameters, self).__init__(**kwargs) - self.pattern = kwargs.get('pattern', None) - self.recall_path = kwargs.get('recall_path', None) - - -class RegisteredServer(ProxyResource): - """Registered Server resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param server_certificate: Registered Server Certificate. - :type server_certificate: str - :param agent_version: Registered Server Agent Version. - :type agent_version: str - :ivar agent_version_status: Registered Server Agent Version Status. Possible values include: - "Ok", "NearExpiry", "Expired", "Blocked". - :vartype agent_version_status: str or - ~azure.mgmt.storagesync.models.RegisteredServerAgentVersionStatus - :ivar agent_version_expiration_date: Registered Server Agent Version Expiration Date. - :vartype agent_version_expiration_date: ~datetime.datetime - :param server_os_version: Registered Server OS Version. - :type server_os_version: str - :ivar server_management_error_code: Registered Server Management Error Code. - :vartype server_management_error_code: int - :ivar last_heart_beat: Registered Server last heart beat. - :vartype last_heart_beat: ~datetime.datetime - :ivar provisioning_state: Registered Server Provisioning State. - :vartype provisioning_state: str - :param server_role: Registered Server serverRole. - :type server_role: str - :param cluster_id: Registered Server clusterId. - :type cluster_id: str - :param cluster_name: Registered Server clusterName. - :type cluster_name: str - :param server_id: Registered Server serverId. - :type server_id: str - :ivar storage_sync_service_uid: Registered Server storageSyncServiceUid. - :vartype storage_sync_service_uid: str - :ivar last_workflow_id: Registered Server lastWorkflowId. - :vartype last_workflow_id: str - :ivar last_operation_name: Resource Last Operation Name. - :vartype last_operation_name: str - :ivar discovery_endpoint_uri: Resource discoveryEndpointUri. - :vartype discovery_endpoint_uri: str - :ivar resource_location: Resource Location. - :vartype resource_location: str - :ivar service_location: Service Location. - :vartype service_location: str - :param friendly_name: Friendly Name. - :type friendly_name: str - :ivar management_endpoint_uri: Management Endpoint Uri. - :vartype management_endpoint_uri: str - :ivar monitoring_endpoint_uri: Telemetry Endpoint Uri. - :vartype monitoring_endpoint_uri: str - :ivar monitoring_configuration: Monitoring Configuration. - :vartype monitoring_configuration: str - :ivar server_name: Server name. - :vartype server_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'agent_version_status': {'readonly': True}, - 'agent_version_expiration_date': {'readonly': True}, - 'server_management_error_code': {'readonly': True}, - 'last_heart_beat': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'storage_sync_service_uid': {'readonly': True}, - 'last_workflow_id': {'readonly': True}, - 'last_operation_name': {'readonly': True}, - 'discovery_endpoint_uri': {'readonly': True}, - 'resource_location': {'readonly': True}, - 'service_location': {'readonly': True}, - 'management_endpoint_uri': {'readonly': True}, - 'monitoring_endpoint_uri': {'readonly': True}, - 'monitoring_configuration': {'readonly': True}, - 'server_name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'server_certificate': {'key': 'properties.serverCertificate', 'type': 'str'}, - 'agent_version': {'key': 'properties.agentVersion', 'type': 'str'}, - 'agent_version_status': {'key': 'properties.agentVersionStatus', 'type': 'str'}, - 'agent_version_expiration_date': {'key': 'properties.agentVersionExpirationDate', 'type': 'iso-8601'}, - 'server_os_version': {'key': 'properties.serverOSVersion', 'type': 'str'}, - 'server_management_error_code': {'key': 'properties.serverManagementErrorCode', 'type': 'int'}, - 'last_heart_beat': {'key': 'properties.lastHeartBeat', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'server_role': {'key': 'properties.serverRole', 'type': 'str'}, - 'cluster_id': {'key': 'properties.clusterId', 'type': 'str'}, - 'cluster_name': {'key': 'properties.clusterName', 'type': 'str'}, - 'server_id': {'key': 'properties.serverId', 'type': 'str'}, - 'storage_sync_service_uid': {'key': 'properties.storageSyncServiceUid', 'type': 'str'}, - 'last_workflow_id': {'key': 'properties.lastWorkflowId', 'type': 'str'}, - 'last_operation_name': {'key': 'properties.lastOperationName', 'type': 'str'}, - 'discovery_endpoint_uri': {'key': 'properties.discoveryEndpointUri', 'type': 'str'}, - 'resource_location': {'key': 'properties.resourceLocation', 'type': 'str'}, - 'service_location': {'key': 'properties.serviceLocation', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'management_endpoint_uri': {'key': 'properties.managementEndpointUri', 'type': 'str'}, - 'monitoring_endpoint_uri': {'key': 'properties.monitoringEndpointUri', 'type': 'str'}, - 'monitoring_configuration': {'key': 'properties.monitoringConfiguration', 'type': 'str'}, - 'server_name': {'key': 'properties.serverName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegisteredServer, self).__init__(**kwargs) - self.server_certificate = kwargs.get('server_certificate', None) - self.agent_version = kwargs.get('agent_version', None) - self.agent_version_status = None - self.agent_version_expiration_date = None - self.server_os_version = kwargs.get('server_os_version', None) - self.server_management_error_code = None - self.last_heart_beat = None - self.provisioning_state = None - self.server_role = kwargs.get('server_role', None) - self.cluster_id = kwargs.get('cluster_id', None) - self.cluster_name = kwargs.get('cluster_name', None) - self.server_id = kwargs.get('server_id', None) - self.storage_sync_service_uid = None - self.last_workflow_id = None - self.last_operation_name = None - self.discovery_endpoint_uri = None - self.resource_location = None - self.service_location = None - self.friendly_name = kwargs.get('friendly_name', None) - self.management_endpoint_uri = None - self.monitoring_endpoint_uri = None - self.monitoring_configuration = None - self.server_name = None - - -class RegisteredServerArray(msrest.serialization.Model): - """Array of RegisteredServer. - - :param value: Collection of Registered Server. - :type value: list[~azure.mgmt.storagesync.models.RegisteredServer] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RegisteredServer]'}, - } - - def __init__( - self, - **kwargs - ): - super(RegisteredServerArray, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class RegisteredServerCreateParameters(ProxyResource): - """The parameters used when creating a registered server. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param server_certificate: Registered Server Certificate. - :type server_certificate: str - :param agent_version: Registered Server Agent Version. - :type agent_version: str - :param server_os_version: Registered Server OS Version. - :type server_os_version: str - :param last_heart_beat: Registered Server last heart beat. - :type last_heart_beat: str - :param server_role: Registered Server serverRole. - :type server_role: str - :param cluster_id: Registered Server clusterId. - :type cluster_id: str - :param cluster_name: Registered Server clusterName. - :type cluster_name: str - :param server_id: Registered Server serverId. - :type server_id: str - :param friendly_name: Friendly Name. - :type friendly_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'server_certificate': {'key': 'properties.serverCertificate', 'type': 'str'}, - 'agent_version': {'key': 'properties.agentVersion', 'type': 'str'}, - 'server_os_version': {'key': 'properties.serverOSVersion', 'type': 'str'}, - 'last_heart_beat': {'key': 'properties.lastHeartBeat', 'type': 'str'}, - 'server_role': {'key': 'properties.serverRole', 'type': 'str'}, - 'cluster_id': {'key': 'properties.clusterId', 'type': 'str'}, - 'cluster_name': {'key': 'properties.clusterName', 'type': 'str'}, - 'server_id': {'key': 'properties.serverId', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegisteredServerCreateParameters, self).__init__(**kwargs) - self.server_certificate = kwargs.get('server_certificate', None) - self.agent_version = kwargs.get('agent_version', None) - self.server_os_version = kwargs.get('server_os_version', None) - self.last_heart_beat = kwargs.get('last_heart_beat', None) - self.server_role = kwargs.get('server_role', None) - self.cluster_id = kwargs.get('cluster_id', None) - self.cluster_name = kwargs.get('cluster_name', None) - self.server_id = kwargs.get('server_id', None) - self.friendly_name = kwargs.get('friendly_name', None) - - -class ResourcesMoveInfo(msrest.serialization.Model): - """Resource Move Info. - - :param target_resource_group: Target resource group. - :type target_resource_group: str - :param resources: Collection of Resources. - :type resources: list[str] - """ - - _attribute_map = { - 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, - 'resources': {'key': 'resources', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourcesMoveInfo, self).__init__(**kwargs) - self.target_resource_group = kwargs.get('target_resource_group', None) - self.resources = kwargs.get('resources', None) - - -class RestoreFileSpec(msrest.serialization.Model): - """Restore file spec. - - :param path: Restore file spec path. - :type path: str - :param isdir: Restore file spec isdir. - :type isdir: bool - """ - - _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, - 'isdir': {'key': 'isdir', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(RestoreFileSpec, self).__init__(**kwargs) - self.path = kwargs.get('path', None) - self.isdir = kwargs.get('isdir', None) - - -class ServerEndpoint(ProxyResource): - """Server Endpoint object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param server_local_path: Server Local path. - :type server_local_path: str - :param cloud_tiering: Cloud Tiering. Possible values include: "on", "off". - :type cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus - :param volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it - is enabled. - :type volume_free_space_percent: int - :param tier_files_older_than_days: Tier files older than days. - :type tier_files_older_than_days: int - :param friendly_name: Friendly Name. - :type friendly_name: str - :param server_resource_id: Server Resource Id. - :type server_resource_id: str - :ivar provisioning_state: ServerEndpoint Provisioning State. - :vartype provisioning_state: str - :ivar last_workflow_id: ServerEndpoint lastWorkflowId. - :vartype last_workflow_id: str - :ivar last_operation_name: Resource Last Operation Name. - :vartype last_operation_name: str - :ivar sync_status: Server Endpoint sync status. - :vartype sync_status: ~azure.mgmt.storagesync.models.ServerEndpointSyncStatus - :param offline_data_transfer: Offline data transfer. Possible values include: "on", "off". - :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus - :ivar offline_data_transfer_storage_account_resource_id: Offline data transfer storage account - resource ID. - :vartype offline_data_transfer_storage_account_resource_id: str - :ivar offline_data_transfer_storage_account_tenant_id: Offline data transfer storage account - tenant ID. - :vartype offline_data_transfer_storage_account_tenant_id: str - :param offline_data_transfer_share_name: Offline data transfer share name. - :type offline_data_transfer_share_name: str - :ivar cloud_tiering_status: Cloud tiering status. Only populated if cloud tiering is enabled. - :vartype cloud_tiering_status: ~azure.mgmt.storagesync.models.ServerEndpointCloudTieringStatus - :ivar recall_status: Recall status. Only populated if cloud tiering is enabled. - :vartype recall_status: ~azure.mgmt.storagesync.models.ServerEndpointRecallStatus - :param initial_download_policy: Policy for how namespace and files are recalled during FastDr. - Possible values include: "NamespaceOnly", "NamespaceThenModifiedFiles", "AvoidTieredFiles". - :type initial_download_policy: str or ~azure.mgmt.storagesync.models.InitialDownloadPolicy - :param local_cache_mode: Policy for enabling follow-the-sun business models: link local cache - to cloud behavior to pre-populate before local access. Possible values include: - "DownloadNewAndModifiedFiles", "UpdateLocallyCachedFiles". - :type local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode - :ivar server_name: Server name. - :vartype server_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'volume_free_space_percent': {'maximum': 100, 'minimum': 0}, - 'tier_files_older_than_days': {'maximum': 2147483647, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, - 'last_workflow_id': {'readonly': True}, - 'last_operation_name': {'readonly': True}, - 'sync_status': {'readonly': True}, - 'offline_data_transfer_storage_account_resource_id': {'readonly': True}, - 'offline_data_transfer_storage_account_tenant_id': {'readonly': True}, - 'cloud_tiering_status': {'readonly': True}, - 'recall_status': {'readonly': True}, - 'server_name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'server_local_path': {'key': 'properties.serverLocalPath', 'type': 'str'}, - 'cloud_tiering': {'key': 'properties.cloudTiering', 'type': 'str'}, - 'volume_free_space_percent': {'key': 'properties.volumeFreeSpacePercent', 'type': 'int'}, - 'tier_files_older_than_days': {'key': 'properties.tierFilesOlderThanDays', 'type': 'int'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'server_resource_id': {'key': 'properties.serverResourceId', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'last_workflow_id': {'key': 'properties.lastWorkflowId', 'type': 'str'}, - 'last_operation_name': {'key': 'properties.lastOperationName', 'type': 'str'}, - 'sync_status': {'key': 'properties.syncStatus', 'type': 'ServerEndpointSyncStatus'}, - 'offline_data_transfer': {'key': 'properties.offlineDataTransfer', 'type': 'str'}, - 'offline_data_transfer_storage_account_resource_id': {'key': 'properties.offlineDataTransferStorageAccountResourceId', 'type': 'str'}, - 'offline_data_transfer_storage_account_tenant_id': {'key': 'properties.offlineDataTransferStorageAccountTenantId', 'type': 'str'}, - 'offline_data_transfer_share_name': {'key': 'properties.offlineDataTransferShareName', 'type': 'str'}, - 'cloud_tiering_status': {'key': 'properties.cloudTieringStatus', 'type': 'ServerEndpointCloudTieringStatus'}, - 'recall_status': {'key': 'properties.recallStatus', 'type': 'ServerEndpointRecallStatus'}, - 'initial_download_policy': {'key': 'properties.initialDownloadPolicy', 'type': 'str'}, - 'local_cache_mode': {'key': 'properties.localCacheMode', 'type': 'str'}, - 'server_name': {'key': 'properties.serverName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerEndpoint, self).__init__(**kwargs) - self.server_local_path = kwargs.get('server_local_path', None) - self.cloud_tiering = kwargs.get('cloud_tiering', None) - self.volume_free_space_percent = kwargs.get('volume_free_space_percent', None) - self.tier_files_older_than_days = kwargs.get('tier_files_older_than_days', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.server_resource_id = kwargs.get('server_resource_id', None) - self.provisioning_state = None - self.last_workflow_id = None - self.last_operation_name = None - self.sync_status = None - self.offline_data_transfer = kwargs.get('offline_data_transfer', None) - self.offline_data_transfer_storage_account_resource_id = None - self.offline_data_transfer_storage_account_tenant_id = None - self.offline_data_transfer_share_name = kwargs.get('offline_data_transfer_share_name', None) - self.cloud_tiering_status = None - self.recall_status = None - self.initial_download_policy = kwargs.get('initial_download_policy', None) - self.local_cache_mode = kwargs.get('local_cache_mode', None) - self.server_name = None - - -class ServerEndpointArray(msrest.serialization.Model): - """Array of ServerEndpoint. - - :param value: Collection of ServerEndpoint. - :type value: list[~azure.mgmt.storagesync.models.ServerEndpoint] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ServerEndpoint]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerEndpointArray, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ServerEndpointBackgroundDataDownloadActivity(msrest.serialization.Model): - """Background data download activity object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar timestamp: Timestamp when properties were updated. - :vartype timestamp: ~datetime.datetime - :ivar percent_progress: Progress percentage. - :vartype percent_progress: int - :ivar downloaded_bytes: Running count of bytes downloaded. - :vartype downloaded_bytes: long - """ - - _validation = { - 'timestamp': {'readonly': True}, - 'percent_progress': {'readonly': True, 'maximum': 100, 'minimum': 0}, - 'downloaded_bytes': {'readonly': True, 'minimum': 0}, - } - - _attribute_map = { - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'percent_progress': {'key': 'percentProgress', 'type': 'int'}, - 'downloaded_bytes': {'key': 'downloadedBytes', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerEndpointBackgroundDataDownloadActivity, self).__init__(**kwargs) - self.timestamp = None - self.percent_progress = None - self.downloaded_bytes = None - - -class ServerEndpointCloudTieringStatus(msrest.serialization.Model): - """Server endpoint cloud tiering status object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar last_updated_timestamp: Last updated timestamp. - :vartype last_updated_timestamp: ~datetime.datetime - :ivar health: Cloud tiering health state. Possible values include: "Unavailable", "Healthy", - "Error". - :vartype health: str or ~azure.mgmt.storagesync.models.ServerEndpointHealthState - :ivar health_last_updated_timestamp: The last updated timestamp of health state. - :vartype health_last_updated_timestamp: ~datetime.datetime - :ivar last_cloud_tiering_result: Last cloud tiering result (HResult). - :vartype last_cloud_tiering_result: int - :ivar last_success_timestamp: Last cloud tiering success timestamp. - :vartype last_success_timestamp: ~datetime.datetime - :ivar space_savings: Information regarding how much local space cloud tiering is saving. - :vartype space_savings: ~azure.mgmt.storagesync.models.CloudTieringSpaceSavings - :ivar cache_performance: Information regarding how well the local cache on the server is - performing. - :vartype cache_performance: ~azure.mgmt.storagesync.models.CloudTieringCachePerformance - :ivar files_not_tiering: Information regarding files that failed to be tiered. - :vartype files_not_tiering: ~azure.mgmt.storagesync.models.CloudTieringFilesNotTiering - :ivar volume_free_space_policy_status: Status of the volume free space policy. - :vartype volume_free_space_policy_status: - ~azure.mgmt.storagesync.models.CloudTieringVolumeFreeSpacePolicyStatus - :ivar date_policy_status: Status of the date policy. - :vartype date_policy_status: ~azure.mgmt.storagesync.models.CloudTieringDatePolicyStatus - """ - - _validation = { - 'last_updated_timestamp': {'readonly': True}, - 'health': {'readonly': True}, - 'health_last_updated_timestamp': {'readonly': True}, - 'last_cloud_tiering_result': {'readonly': True}, - 'last_success_timestamp': {'readonly': True}, - 'space_savings': {'readonly': True}, - 'cache_performance': {'readonly': True}, - 'files_not_tiering': {'readonly': True}, - 'volume_free_space_policy_status': {'readonly': True}, - 'date_policy_status': {'readonly': True}, - } - - _attribute_map = { - 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, - 'health': {'key': 'health', 'type': 'str'}, - 'health_last_updated_timestamp': {'key': 'healthLastUpdatedTimestamp', 'type': 'iso-8601'}, - 'last_cloud_tiering_result': {'key': 'lastCloudTieringResult', 'type': 'int'}, - 'last_success_timestamp': {'key': 'lastSuccessTimestamp', 'type': 'iso-8601'}, - 'space_savings': {'key': 'spaceSavings', 'type': 'CloudTieringSpaceSavings'}, - 'cache_performance': {'key': 'cachePerformance', 'type': 'CloudTieringCachePerformance'}, - 'files_not_tiering': {'key': 'filesNotTiering', 'type': 'CloudTieringFilesNotTiering'}, - 'volume_free_space_policy_status': {'key': 'volumeFreeSpacePolicyStatus', 'type': 'CloudTieringVolumeFreeSpacePolicyStatus'}, - 'date_policy_status': {'key': 'datePolicyStatus', 'type': 'CloudTieringDatePolicyStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerEndpointCloudTieringStatus, self).__init__(**kwargs) - self.last_updated_timestamp = None - self.health = None - self.health_last_updated_timestamp = None - self.last_cloud_tiering_result = None - self.last_success_timestamp = None - self.space_savings = None - self.cache_performance = None - self.files_not_tiering = None - self.volume_free_space_policy_status = None - self.date_policy_status = None - - -class ServerEndpointCreateParameters(ProxyResource): - """The parameters used when creating a server endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param server_local_path: Server Local path. - :type server_local_path: str - :param cloud_tiering: Cloud Tiering. Possible values include: "on", "off". - :type cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus - :param volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it - is enabled. - :type volume_free_space_percent: int - :param tier_files_older_than_days: Tier files older than days. - :type tier_files_older_than_days: int - :param friendly_name: Friendly Name. - :type friendly_name: str - :param server_resource_id: Server Resource Id. - :type server_resource_id: str - :param offline_data_transfer: Offline data transfer. Possible values include: "on", "off". - :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus - :param offline_data_transfer_share_name: Offline data transfer share name. - :type offline_data_transfer_share_name: str - :param initial_download_policy: Policy for how namespace and files are recalled during FastDr. - Possible values include: "NamespaceOnly", "NamespaceThenModifiedFiles", "AvoidTieredFiles". - :type initial_download_policy: str or ~azure.mgmt.storagesync.models.InitialDownloadPolicy - :param local_cache_mode: Policy for enabling follow-the-sun business models: link local cache - to cloud behavior to pre-populate before local access. Possible values include: - "DownloadNewAndModifiedFiles", "UpdateLocallyCachedFiles". - :type local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'volume_free_space_percent': {'maximum': 100, 'minimum': 0}, - 'tier_files_older_than_days': {'maximum': 2147483647, 'minimum': 0}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'server_local_path': {'key': 'properties.serverLocalPath', 'type': 'str'}, - 'cloud_tiering': {'key': 'properties.cloudTiering', 'type': 'str'}, - 'volume_free_space_percent': {'key': 'properties.volumeFreeSpacePercent', 'type': 'int'}, - 'tier_files_older_than_days': {'key': 'properties.tierFilesOlderThanDays', 'type': 'int'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'server_resource_id': {'key': 'properties.serverResourceId', 'type': 'str'}, - 'offline_data_transfer': {'key': 'properties.offlineDataTransfer', 'type': 'str'}, - 'offline_data_transfer_share_name': {'key': 'properties.offlineDataTransferShareName', 'type': 'str'}, - 'initial_download_policy': {'key': 'properties.initialDownloadPolicy', 'type': 'str'}, - 'local_cache_mode': {'key': 'properties.localCacheMode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerEndpointCreateParameters, self).__init__(**kwargs) - self.server_local_path = kwargs.get('server_local_path', None) - self.cloud_tiering = kwargs.get('cloud_tiering', None) - self.volume_free_space_percent = kwargs.get('volume_free_space_percent', None) - self.tier_files_older_than_days = kwargs.get('tier_files_older_than_days', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.server_resource_id = kwargs.get('server_resource_id', None) - self.offline_data_transfer = kwargs.get('offline_data_transfer', None) - self.offline_data_transfer_share_name = kwargs.get('offline_data_transfer_share_name', None) - self.initial_download_policy = kwargs.get('initial_download_policy', None) - self.local_cache_mode = kwargs.get('local_cache_mode', None) - - -class ServerEndpointFilesNotSyncingError(msrest.serialization.Model): - """Files not syncing error object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_code: Error code (HResult). - :vartype error_code: int - :ivar persistent_count: Count of persistent files not syncing with the specified error code. - :vartype persistent_count: long - :ivar transient_count: Count of transient files not syncing with the specified error code. - :vartype transient_count: long - """ - - _validation = { - 'error_code': {'readonly': True}, - 'persistent_count': {'readonly': True, 'minimum': 0}, - 'transient_count': {'readonly': True, 'minimum': 0}, - } - - _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'int'}, - 'persistent_count': {'key': 'persistentCount', 'type': 'long'}, - 'transient_count': {'key': 'transientCount', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerEndpointFilesNotSyncingError, self).__init__(**kwargs) - self.error_code = None - self.persistent_count = None - self.transient_count = None - - -class ServerEndpointRecallError(msrest.serialization.Model): - """Server endpoint recall error object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_code: Error code (HResult). - :vartype error_code: int - :ivar count: Count of occurences of the error. - :vartype count: long - """ - - _validation = { - 'error_code': {'readonly': True}, - 'count': {'readonly': True, 'minimum': 0}, - } - - _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'int'}, - 'count': {'key': 'count', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerEndpointRecallError, self).__init__(**kwargs) - self.error_code = None - self.count = None - - -class ServerEndpointRecallStatus(msrest.serialization.Model): - """Server endpoint recall status object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar last_updated_timestamp: Last updated timestamp. - :vartype last_updated_timestamp: ~datetime.datetime - :ivar total_recall_errors_count: Total count of recall errors. - :vartype total_recall_errors_count: long - :ivar recall_errors: Array of recall errors. - :vartype recall_errors: list[~azure.mgmt.storagesync.models.ServerEndpointRecallError] - """ - - _validation = { - 'last_updated_timestamp': {'readonly': True}, - 'total_recall_errors_count': {'readonly': True, 'minimum': 0}, - 'recall_errors': {'readonly': True}, - } - - _attribute_map = { - 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, - 'total_recall_errors_count': {'key': 'totalRecallErrorsCount', 'type': 'long'}, - 'recall_errors': {'key': 'recallErrors', 'type': '[ServerEndpointRecallError]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerEndpointRecallStatus, self).__init__(**kwargs) - self.last_updated_timestamp = None - self.total_recall_errors_count = None - self.recall_errors = None - - -class ServerEndpointSyncActivityStatus(msrest.serialization.Model): - """Sync Session status object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar timestamp: Timestamp when properties were updated. - :vartype timestamp: ~datetime.datetime - :ivar per_item_error_count: Per item error count. - :vartype per_item_error_count: long - :ivar applied_item_count: Applied item count. - :vartype applied_item_count: long - :ivar total_item_count: Total item count (if available). - :vartype total_item_count: long - :ivar applied_bytes: Applied bytes. - :vartype applied_bytes: long - :ivar total_bytes: Total bytes (if available). - :vartype total_bytes: long - :ivar sync_mode: Sync mode. Possible values include: "Regular", "NamespaceDownload", - "InitialUpload", "SnapshotUpload", "InitialFullDownload". - :vartype sync_mode: str or ~azure.mgmt.storagesync.models.ServerEndpointSyncMode - """ - - _validation = { - 'timestamp': {'readonly': True}, - 'per_item_error_count': {'readonly': True, 'minimum': 0}, - 'applied_item_count': {'readonly': True, 'minimum': 0}, - 'total_item_count': {'readonly': True, 'minimum': 0}, - 'applied_bytes': {'readonly': True, 'minimum': 0}, - 'total_bytes': {'readonly': True, 'minimum': 0}, - 'sync_mode': {'readonly': True}, - } - - _attribute_map = { - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'per_item_error_count': {'key': 'perItemErrorCount', 'type': 'long'}, - 'applied_item_count': {'key': 'appliedItemCount', 'type': 'long'}, - 'total_item_count': {'key': 'totalItemCount', 'type': 'long'}, - 'applied_bytes': {'key': 'appliedBytes', 'type': 'long'}, - 'total_bytes': {'key': 'totalBytes', 'type': 'long'}, - 'sync_mode': {'key': 'syncMode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerEndpointSyncActivityStatus, self).__init__(**kwargs) - self.timestamp = None - self.per_item_error_count = None - self.applied_item_count = None - self.total_item_count = None - self.applied_bytes = None - self.total_bytes = None - self.sync_mode = None - - -class ServerEndpointSyncSessionStatus(msrest.serialization.Model): - """Sync Session status object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar last_sync_result: Last sync result (HResult). - :vartype last_sync_result: int - :ivar last_sync_timestamp: Last sync timestamp. - :vartype last_sync_timestamp: ~datetime.datetime - :ivar last_sync_success_timestamp: Last sync success timestamp. - :vartype last_sync_success_timestamp: ~datetime.datetime - :ivar last_sync_per_item_error_count: Last sync per item error count. - :vartype last_sync_per_item_error_count: long - :ivar persistent_files_not_syncing_count: Count of persistent files not syncing. - :vartype persistent_files_not_syncing_count: long - :ivar transient_files_not_syncing_count: Count of transient files not syncing. - :vartype transient_files_not_syncing_count: long - :ivar files_not_syncing_errors: Array of per-item errors coming from the last sync session. - :vartype files_not_syncing_errors: - list[~azure.mgmt.storagesync.models.ServerEndpointFilesNotSyncingError] - :ivar last_sync_mode: Sync mode. Possible values include: "Regular", "NamespaceDownload", - "InitialUpload", "SnapshotUpload", "InitialFullDownload". - :vartype last_sync_mode: str or ~azure.mgmt.storagesync.models.ServerEndpointSyncMode - """ - - _validation = { - 'last_sync_result': {'readonly': True}, - 'last_sync_timestamp': {'readonly': True}, - 'last_sync_success_timestamp': {'readonly': True}, - 'last_sync_per_item_error_count': {'readonly': True, 'minimum': 0}, - 'persistent_files_not_syncing_count': {'readonly': True, 'minimum': 0}, - 'transient_files_not_syncing_count': {'readonly': True, 'minimum': 0}, - 'files_not_syncing_errors': {'readonly': True}, - 'last_sync_mode': {'readonly': True}, - } - - _attribute_map = { - 'last_sync_result': {'key': 'lastSyncResult', 'type': 'int'}, - 'last_sync_timestamp': {'key': 'lastSyncTimestamp', 'type': 'iso-8601'}, - 'last_sync_success_timestamp': {'key': 'lastSyncSuccessTimestamp', 'type': 'iso-8601'}, - 'last_sync_per_item_error_count': {'key': 'lastSyncPerItemErrorCount', 'type': 'long'}, - 'persistent_files_not_syncing_count': {'key': 'persistentFilesNotSyncingCount', 'type': 'long'}, - 'transient_files_not_syncing_count': {'key': 'transientFilesNotSyncingCount', 'type': 'long'}, - 'files_not_syncing_errors': {'key': 'filesNotSyncingErrors', 'type': '[ServerEndpointFilesNotSyncingError]'}, - 'last_sync_mode': {'key': 'lastSyncMode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerEndpointSyncSessionStatus, self).__init__(**kwargs) - self.last_sync_result = None - self.last_sync_timestamp = None - self.last_sync_success_timestamp = None - self.last_sync_per_item_error_count = None - self.persistent_files_not_syncing_count = None - self.transient_files_not_syncing_count = None - self.files_not_syncing_errors = None - self.last_sync_mode = None - - -class ServerEndpointSyncStatus(msrest.serialization.Model): - """Server Endpoint sync status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar download_health: Download Health Status. Possible values include: "Unavailable", - "Healthy", "Error". - :vartype download_health: str or ~azure.mgmt.storagesync.models.ServerEndpointHealthState - :ivar upload_health: Upload Health Status. Possible values include: "Unavailable", "Healthy", - "Error". - :vartype upload_health: str or ~azure.mgmt.storagesync.models.ServerEndpointHealthState - :ivar combined_health: Combined Health Status. Possible values include: "Unavailable", - "Healthy", "Error". - :vartype combined_health: str or ~azure.mgmt.storagesync.models.ServerEndpointHealthState - :ivar sync_activity: Sync activity. Possible values include: "Upload", "Download", - "UploadAndDownload". - :vartype sync_activity: str or ~azure.mgmt.storagesync.models.ServerEndpointSyncActivityState - :ivar total_persistent_files_not_syncing_count: Total count of persistent files not syncing - (combined upload + download). - :vartype total_persistent_files_not_syncing_count: long - :ivar last_updated_timestamp: Last Updated Timestamp. - :vartype last_updated_timestamp: ~datetime.datetime - :ivar upload_status: Upload Status. - :vartype upload_status: ~azure.mgmt.storagesync.models.ServerEndpointSyncSessionStatus - :ivar download_status: Download Status. - :vartype download_status: ~azure.mgmt.storagesync.models.ServerEndpointSyncSessionStatus - :ivar upload_activity: Upload sync activity. - :vartype upload_activity: ~azure.mgmt.storagesync.models.ServerEndpointSyncActivityStatus - :ivar download_activity: Download sync activity. - :vartype download_activity: ~azure.mgmt.storagesync.models.ServerEndpointSyncActivityStatus - :ivar offline_data_transfer_status: Offline Data Transfer State. Possible values include: - "InProgress", "Stopping", "NotRunning", "Complete". - :vartype offline_data_transfer_status: str or - ~azure.mgmt.storagesync.models.ServerEndpointOfflineDataTransferState - :ivar background_data_download_activity: Background data download activity. - :vartype background_data_download_activity: - ~azure.mgmt.storagesync.models.ServerEndpointBackgroundDataDownloadActivity - """ - - _validation = { - 'download_health': {'readonly': True}, - 'upload_health': {'readonly': True}, - 'combined_health': {'readonly': True}, - 'sync_activity': {'readonly': True}, - 'total_persistent_files_not_syncing_count': {'readonly': True, 'minimum': 0}, - 'last_updated_timestamp': {'readonly': True}, - 'upload_status': {'readonly': True}, - 'download_status': {'readonly': True}, - 'upload_activity': {'readonly': True}, - 'download_activity': {'readonly': True}, - 'offline_data_transfer_status': {'readonly': True}, - 'background_data_download_activity': {'readonly': True}, - } - - _attribute_map = { - 'download_health': {'key': 'downloadHealth', 'type': 'str'}, - 'upload_health': {'key': 'uploadHealth', 'type': 'str'}, - 'combined_health': {'key': 'combinedHealth', 'type': 'str'}, - 'sync_activity': {'key': 'syncActivity', 'type': 'str'}, - 'total_persistent_files_not_syncing_count': {'key': 'totalPersistentFilesNotSyncingCount', 'type': 'long'}, - 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, - 'upload_status': {'key': 'uploadStatus', 'type': 'ServerEndpointSyncSessionStatus'}, - 'download_status': {'key': 'downloadStatus', 'type': 'ServerEndpointSyncSessionStatus'}, - 'upload_activity': {'key': 'uploadActivity', 'type': 'ServerEndpointSyncActivityStatus'}, - 'download_activity': {'key': 'downloadActivity', 'type': 'ServerEndpointSyncActivityStatus'}, - 'offline_data_transfer_status': {'key': 'offlineDataTransferStatus', 'type': 'str'}, - 'background_data_download_activity': {'key': 'backgroundDataDownloadActivity', 'type': 'ServerEndpointBackgroundDataDownloadActivity'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerEndpointSyncStatus, self).__init__(**kwargs) - self.download_health = None - self.upload_health = None - self.combined_health = None - self.sync_activity = None - self.total_persistent_files_not_syncing_count = None - self.last_updated_timestamp = None - self.upload_status = None - self.download_status = None - self.upload_activity = None - self.download_activity = None - self.offline_data_transfer_status = None - self.background_data_download_activity = None - - -class ServerEndpointUpdateParameters(msrest.serialization.Model): - """Parameters for updating an Server Endpoint. - - :param cloud_tiering: Cloud Tiering. Possible values include: "on", "off". - :type cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus - :param volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it - is enabled. - :type volume_free_space_percent: int - :param tier_files_older_than_days: Tier files older than days. - :type tier_files_older_than_days: int - :param offline_data_transfer: Offline data transfer. Possible values include: "on", "off". - :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus - :param offline_data_transfer_share_name: Offline data transfer share name. - :type offline_data_transfer_share_name: str - :param local_cache_mode: Policy for enabling follow-the-sun business models: link local cache - to cloud behavior to pre-populate before local access. Possible values include: - "DownloadNewAndModifiedFiles", "UpdateLocallyCachedFiles". - :type local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode - """ - - _validation = { - 'volume_free_space_percent': {'maximum': 100, 'minimum': 0}, - 'tier_files_older_than_days': {'maximum': 2147483647, 'minimum': 0}, - } - - _attribute_map = { - 'cloud_tiering': {'key': 'properties.cloudTiering', 'type': 'str'}, - 'volume_free_space_percent': {'key': 'properties.volumeFreeSpacePercent', 'type': 'int'}, - 'tier_files_older_than_days': {'key': 'properties.tierFilesOlderThanDays', 'type': 'int'}, - 'offline_data_transfer': {'key': 'properties.offlineDataTransfer', 'type': 'str'}, - 'offline_data_transfer_share_name': {'key': 'properties.offlineDataTransferShareName', 'type': 'str'}, - 'local_cache_mode': {'key': 'properties.localCacheMode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerEndpointUpdateParameters, self).__init__(**kwargs) - self.cloud_tiering = kwargs.get('cloud_tiering', None) - self.volume_free_space_percent = kwargs.get('volume_free_space_percent', None) - self.tier_files_older_than_days = kwargs.get('tier_files_older_than_days', None) - self.offline_data_transfer = kwargs.get('offline_data_transfer', None) - self.offline_data_transfer_share_name = kwargs.get('offline_data_transfer_share_name', None) - self.local_cache_mode = kwargs.get('local_cache_mode', None) - - -class StorageSyncApiError(msrest.serialization.Model): - """Error type. - - :param code: Error code of the given entry. - :type code: str - :param message: Error message of the given entry. - :type message: str - :param target: Target of the given error entry. - :type target: str - :param details: Error details of the given entry. - :type details: ~azure.mgmt.storagesync.models.StorageSyncErrorDetails - :param inner_error: Inner error details of the given entry. - :type inner_error: ~azure.mgmt.storagesync.models.StorageSyncInnerErrorDetails - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'StorageSyncErrorDetails'}, - 'inner_error': {'key': 'innerError', 'type': 'StorageSyncInnerErrorDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSyncApiError, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - self.inner_error = kwargs.get('inner_error', None) - - -class StorageSyncError(msrest.serialization.Model): - """Error type. - - :param error: Error details of the given entry. - :type error: ~azure.mgmt.storagesync.models.StorageSyncApiError - :param innererror: Error details of the given entry. - :type innererror: ~azure.mgmt.storagesync.models.StorageSyncApiError - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'StorageSyncApiError'}, - 'innererror': {'key': 'innererror', 'type': 'StorageSyncApiError'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSyncError, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - self.innererror = kwargs.get('innererror', None) - - -class StorageSyncErrorDetails(msrest.serialization.Model): - """Error Details object. - - :param code: Error code of the given entry. - :type code: str - :param message: Error message of the given entry. - :type message: str - :param target: Target of the given entry. - :type target: str - :param request_uri: Request URI of the given entry. - :type request_uri: str - :param exception_type: Exception type of the given entry. - :type exception_type: str - :param http_method: HTTP method of the given entry. - :type http_method: str - :param hashed_message: Hashed message of the given entry. - :type hashed_message: str - :param http_error_code: HTTP error code of the given entry. - :type http_error_code: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'request_uri': {'key': 'requestUri', 'type': 'str'}, - 'exception_type': {'key': 'exceptionType', 'type': 'str'}, - 'http_method': {'key': 'httpMethod', 'type': 'str'}, - 'hashed_message': {'key': 'hashedMessage', 'type': 'str'}, - 'http_error_code': {'key': 'httpErrorCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSyncErrorDetails, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.request_uri = kwargs.get('request_uri', None) - self.exception_type = kwargs.get('exception_type', None) - self.http_method = kwargs.get('http_method', None) - self.hashed_message = kwargs.get('hashed_message', None) - self.http_error_code = kwargs.get('http_error_code', None) - - -class StorageSyncInnerErrorDetails(msrest.serialization.Model): - """Error Details object. - - :param call_stack: Call stack of the error. - :type call_stack: str - :param message: Error message of the error. - :type message: str - :param inner_exception: Exception of the inner error. - :type inner_exception: str - :param inner_exception_call_stack: Call stack of the inner error. - :type inner_exception_call_stack: str - """ - - _attribute_map = { - 'call_stack': {'key': 'callStack', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'inner_exception': {'key': 'innerException', 'type': 'str'}, - 'inner_exception_call_stack': {'key': 'innerExceptionCallStack', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSyncInnerErrorDetails, self).__init__(**kwargs) - self.call_stack = kwargs.get('call_stack', None) - self.message = kwargs.get('message', None) - self.inner_exception = kwargs.get('inner_exception', None) - self.inner_exception_call_stack = kwargs.get('inner_exception_call_stack', None) - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class StorageSyncService(TrackedResource): - """Storage Sync Service object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param incoming_traffic_policy: Incoming Traffic Policy. Possible values include: - "AllowAllTraffic", "AllowVirtualNetworksOnly". - :type incoming_traffic_policy: str or ~azure.mgmt.storagesync.models.IncomingTrafficPolicy - :ivar storage_sync_service_status: Storage Sync service status. - :vartype storage_sync_service_status: int - :ivar storage_sync_service_uid: Storage Sync service Uid. - :vartype storage_sync_service_uid: str - :ivar provisioning_state: StorageSyncService Provisioning State. - :vartype provisioning_state: str - :ivar last_workflow_id: StorageSyncService lastWorkflowId. - :vartype last_workflow_id: str - :ivar last_operation_name: Resource Last Operation Name. - :vartype last_operation_name: str - :ivar private_endpoint_connections: List of private endpoint connection associated with the - specified storage sync service. - :vartype private_endpoint_connections: - list[~azure.mgmt.storagesync.models.PrivateEndpointConnection] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'storage_sync_service_status': {'readonly': True}, - 'storage_sync_service_uid': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'last_workflow_id': {'readonly': True}, - 'last_operation_name': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'incoming_traffic_policy': {'key': 'properties.incomingTrafficPolicy', 'type': 'str'}, - 'storage_sync_service_status': {'key': 'properties.storageSyncServiceStatus', 'type': 'int'}, - 'storage_sync_service_uid': {'key': 'properties.storageSyncServiceUid', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'last_workflow_id': {'key': 'properties.lastWorkflowId', 'type': 'str'}, - 'last_operation_name': {'key': 'properties.lastOperationName', 'type': 'str'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSyncService, self).__init__(**kwargs) - self.incoming_traffic_policy = kwargs.get('incoming_traffic_policy', None) - self.storage_sync_service_status = None - self.storage_sync_service_uid = None - self.provisioning_state = None - self.last_workflow_id = None - self.last_operation_name = None - self.private_endpoint_connections = None - - -class StorageSyncServiceArray(msrest.serialization.Model): - """Array of StorageSyncServices. - - :param value: Collection of StorageSyncServices. - :type value: list[~azure.mgmt.storagesync.models.StorageSyncService] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageSyncService]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSyncServiceArray, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class StorageSyncServiceCreateParameters(msrest.serialization.Model): - """The parameters used when creating a storage sync service. - - All required parameters must be populated in order to send to Azure. - - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, - etc.). The geo region of a resource cannot be changed once it is created, but if an identical - geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used for viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no - greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param incoming_traffic_policy: Incoming Traffic Policy. Possible values include: - "AllowAllTraffic", "AllowVirtualNetworksOnly". - :type incoming_traffic_policy: str or ~azure.mgmt.storagesync.models.IncomingTrafficPolicy - """ - - _validation = { - 'location': {'required': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'incoming_traffic_policy': {'key': 'properties.incomingTrafficPolicy', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSyncServiceCreateParameters, self).__init__(**kwargs) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.incoming_traffic_policy = kwargs.get('incoming_traffic_policy', None) - - -class StorageSyncServiceUpdateParameters(msrest.serialization.Model): - """Parameters for updating an Storage sync service. - - :param tags: A set of tags. The user-specified tags associated with the storage sync service. - :type tags: dict[str, str] - :param incoming_traffic_policy: Incoming Traffic Policy. Possible values include: - "AllowAllTraffic", "AllowVirtualNetworksOnly". - :type incoming_traffic_policy: str or ~azure.mgmt.storagesync.models.IncomingTrafficPolicy - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'incoming_traffic_policy': {'key': 'properties.incomingTrafficPolicy', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSyncServiceUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.incoming_traffic_policy = kwargs.get('incoming_traffic_policy', None) - - -class SubscriptionState(msrest.serialization.Model): - """Subscription State object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param state: State of Azure Subscription. Possible values include: "Registered", - "Unregistered", "Warned", "Suspended", "Deleted". - :type state: str or ~azure.mgmt.storagesync.models.Reason - :ivar istransitioning: Is Transitioning. - :vartype istransitioning: bool - :param properties: Subscription state properties. - :type properties: object - """ - - _validation = { - 'istransitioning': {'readonly': True}, - } - - _attribute_map = { - 'state': {'key': 'state', 'type': 'str'}, - 'istransitioning': {'key': 'istransitioning', 'type': 'bool'}, - 'properties': {'key': 'properties', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(SubscriptionState, self).__init__(**kwargs) - self.state = kwargs.get('state', None) - self.istransitioning = None - self.properties = kwargs.get('properties', None) - - -class SyncGroup(ProxyResource): - """Sync Group object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar unique_id: Unique Id. - :vartype unique_id: str - :ivar sync_group_status: Sync group status. - :vartype sync_group_status: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'unique_id': {'readonly': True}, - 'sync_group_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'sync_group_status': {'key': 'properties.syncGroupStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SyncGroup, self).__init__(**kwargs) - self.unique_id = None - self.sync_group_status = None - - -class SyncGroupArray(msrest.serialization.Model): - """Array of SyncGroup. - - :param value: Collection of SyncGroup. - :type value: list[~azure.mgmt.storagesync.models.SyncGroup] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SyncGroup]'}, - } - - def __init__( - self, - **kwargs - ): - super(SyncGroupArray, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class SyncGroupCreateParameters(ProxyResource): - """The parameters used when creating a sync group. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param properties: The parameters used to create the sync group. - :type properties: object - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(SyncGroupCreateParameters, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class TriggerChangeDetectionParameters(msrest.serialization.Model): - """The parameters used when calling trigger change detection action on cloud endpoint. - - :param directory_path: Relative path to a directory Azure File share for which change detection - is to be performed. - :type directory_path: str - :param change_detection_mode: Change Detection Mode. Applies to a directory specified in - directoryPath parameter. Possible values include: "Default", "Recursive". - :type change_detection_mode: str or ~azure.mgmt.storagesync.models.ChangeDetectionMode - :param paths: Array of relative paths on the Azure File share to be included in the change - detection. Can be files and directories. - :type paths: list[str] - """ - - _attribute_map = { - 'directory_path': {'key': 'directoryPath', 'type': 'str'}, - 'change_detection_mode': {'key': 'changeDetectionMode', 'type': 'str'}, - 'paths': {'key': 'paths', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(TriggerChangeDetectionParameters, self).__init__(**kwargs) - self.directory_path = kwargs.get('directory_path', None) - self.change_detection_mode = kwargs.get('change_detection_mode', None) - self.paths = kwargs.get('paths', None) - - -class TriggerRolloverRequest(msrest.serialization.Model): - """Trigger Rollover Request. - - :param server_certificate: Certificate Data. - :type server_certificate: str - """ - - _attribute_map = { - 'server_certificate': {'key': 'serverCertificate', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TriggerRolloverRequest, self).__init__(**kwargs) - self.server_certificate = kwargs.get('server_certificate', None) - - -class Workflow(ProxyResource): - """Workflow resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar last_step_name: last step name. - :vartype last_step_name: str - :ivar status: workflow status. Possible values include: "active", "expired", "succeeded", - "aborted", "failed". - :vartype status: str or ~azure.mgmt.storagesync.models.WorkflowStatus - :ivar operation: operation direction. Possible values include: "do", "undo", "cancel". - :vartype operation: str or ~azure.mgmt.storagesync.models.OperationDirection - :ivar steps: workflow steps. - :vartype steps: str - :ivar last_operation_id: workflow last operation identifier. - :vartype last_operation_id: str - :ivar command_name: workflow command name. - :vartype command_name: str - :ivar created_timestamp: workflow created timestamp. - :vartype created_timestamp: ~datetime.datetime - :ivar last_status_timestamp: workflow last status timestamp. - :vartype last_status_timestamp: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'last_step_name': {'readonly': True}, - 'status': {'readonly': True}, - 'operation': {'readonly': True}, - 'steps': {'readonly': True}, - 'last_operation_id': {'readonly': True}, - 'command_name': {'readonly': True}, - 'created_timestamp': {'readonly': True}, - 'last_status_timestamp': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'last_step_name': {'key': 'properties.lastStepName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'operation': {'key': 'properties.operation', 'type': 'str'}, - 'steps': {'key': 'properties.steps', 'type': 'str'}, - 'last_operation_id': {'key': 'properties.lastOperationId', 'type': 'str'}, - 'command_name': {'key': 'properties.commandName', 'type': 'str'}, - 'created_timestamp': {'key': 'properties.createdTimestamp', 'type': 'iso-8601'}, - 'last_status_timestamp': {'key': 'properties.lastStatusTimestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(Workflow, self).__init__(**kwargs) - self.last_step_name = None - self.status = None - self.operation = None - self.steps = None - self.last_operation_id = None - self.command_name = None - self.created_timestamp = None - self.last_status_timestamp = None - - -class WorkflowArray(msrest.serialization.Model): - """Array of Workflow. - - :param value: Collection of workflow items. - :type value: list[~azure.mgmt.storagesync.models.Workflow] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Workflow]'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkflowArray, self).__init__(**kwargs) - self.value = kwargs.get('value', None) diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_models_py3.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_models_py3.py index 37514c302f29..e25876e41bcd 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_models_py3.py @@ -6,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +import datetime +from typing import Any, Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError import msrest.serialization @@ -17,8 +18,8 @@ class BackupRequest(msrest.serialization.Model): """Backup request. - :param azure_file_share: Azure File Share. - :type azure_file_share: str + :ivar azure_file_share: Azure File Share. + :vartype azure_file_share: str """ _attribute_map = { @@ -31,6 +32,10 @@ def __init__( azure_file_share: Optional[str] = None, **kwargs ): + """ + :keyword azure_file_share: Azure File Share. + :paramtype azure_file_share: str + """ super(BackupRequest, self).__init__(**kwargs) self.azure_file_share = azure_file_share @@ -42,11 +47,10 @@ class CheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name to check for availability. - :type name: str - :ivar type: Required. The resource type. Must be set to - Microsoft.StorageSync/storageSyncServices. Default value: - "Microsoft.StorageSync/storageSyncServices". + :ivar name: Required. The name to check for availability. + :vartype name: str + :ivar type: The resource type. Must be set to Microsoft.StorageSync/storageSyncServices. Has + constant value: "Microsoft.StorageSync/storageSyncServices". :vartype type: str """ @@ -68,6 +72,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The name to check for availability. + :paramtype name: str + """ super(CheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -105,6 +113,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -124,28 +134,36 @@ class Resource(msrest.serialization.Model): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None self.type = None + self.system_data = None class ProxyResource(Resource): @@ -161,24 +179,31 @@ class ProxyResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -195,37 +220,46 @@ class CloudEndpoint(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param storage_account_resource_id: Storage Account Resource Id. - :type storage_account_resource_id: str - :param azure_file_share_name: Azure file share name. - :type azure_file_share_name: str - :param storage_account_tenant_id: Storage Account Tenant Id. - :type storage_account_tenant_id: str - :param partnership_id: Partnership Id. - :type partnership_id: str - :param friendly_name: Friendly Name. - :type friendly_name: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar storage_account_resource_id: Storage Account Resource Id. + :vartype storage_account_resource_id: str + :ivar azure_file_share_name: Azure file share name. + :vartype azure_file_share_name: str + :ivar storage_account_tenant_id: Storage Account Tenant Id. + :vartype storage_account_tenant_id: str + :ivar partnership_id: Partnership Id. + :vartype partnership_id: str + :ivar friendly_name: Friendly Name. + :vartype friendly_name: str :ivar backup_enabled: Backup Enabled. :vartype backup_enabled: str - :param provisioning_state: CloudEndpoint Provisioning State. - :type provisioning_state: str - :param last_workflow_id: CloudEndpoint lastWorkflowId. - :type last_workflow_id: str - :param last_operation_name: Resource Last Operation Name. - :type last_operation_name: str + :ivar provisioning_state: CloudEndpoint Provisioning State. + :vartype provisioning_state: str + :ivar last_workflow_id: CloudEndpoint lastWorkflowId. + :vartype last_workflow_id: str + :ivar last_operation_name: Resource Last Operation Name. + :vartype last_operation_name: str + :ivar change_enumeration_status: Cloud endpoint change enumeration status. + :vartype change_enumeration_status: + ~azure.mgmt.storagesync.models.CloudEndpointChangeEnumerationStatus """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, 'backup_enabled': {'readonly': True}, + 'change_enumeration_status': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, 'azure_file_share_name': {'key': 'properties.azureFileShareName', 'type': 'str'}, 'storage_account_tenant_id': {'key': 'properties.storageAccountTenantId', 'type': 'str'}, @@ -235,6 +269,7 @@ class CloudEndpoint(ProxyResource): 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'last_workflow_id': {'key': 'properties.lastWorkflowId', 'type': 'str'}, 'last_operation_name': {'key': 'properties.lastOperationName', 'type': 'str'}, + 'change_enumeration_status': {'key': 'properties.changeEnumerationStatus', 'type': 'CloudEndpointChangeEnumerationStatus'}, } def __init__( @@ -250,6 +285,24 @@ def __init__( last_operation_name: Optional[str] = None, **kwargs ): + """ + :keyword storage_account_resource_id: Storage Account Resource Id. + :paramtype storage_account_resource_id: str + :keyword azure_file_share_name: Azure file share name. + :paramtype azure_file_share_name: str + :keyword storage_account_tenant_id: Storage Account Tenant Id. + :paramtype storage_account_tenant_id: str + :keyword partnership_id: Partnership Id. + :paramtype partnership_id: str + :keyword friendly_name: Friendly Name. + :paramtype friendly_name: str + :keyword provisioning_state: CloudEndpoint Provisioning State. + :paramtype provisioning_state: str + :keyword last_workflow_id: CloudEndpoint lastWorkflowId. + :paramtype last_workflow_id: str + :keyword last_operation_name: Resource Last Operation Name. + :paramtype last_operation_name: str + """ super(CloudEndpoint, self).__init__(**kwargs) self.storage_account_resource_id = storage_account_resource_id self.azure_file_share_name = azure_file_share_name @@ -260,13 +313,14 @@ def __init__( self.provisioning_state = provisioning_state self.last_workflow_id = last_workflow_id self.last_operation_name = last_operation_name + self.change_enumeration_status = None class CloudEndpointArray(msrest.serialization.Model): """Array of CloudEndpoint. - :param value: Collection of CloudEndpoint. - :type value: list[~azure.mgmt.storagesync.models.CloudEndpoint] + :ivar value: Collection of CloudEndpoint. + :vartype value: list[~azure.mgmt.storagesync.models.CloudEndpoint] """ _attribute_map = { @@ -279,10 +333,145 @@ def __init__( value: Optional[List["CloudEndpoint"]] = None, **kwargs ): + """ + :keyword value: Collection of CloudEndpoint. + :paramtype value: list[~azure.mgmt.storagesync.models.CloudEndpoint] + """ super(CloudEndpointArray, self).__init__(**kwargs) self.value = value +class CloudEndpointChangeEnumerationActivity(msrest.serialization.Model): + """Cloud endpoint change enumeration activity object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar operation_state: Change enumeration operation state. Possible values include: + "InitialEnumerationInProgress", "EnumerationInProgress". + :vartype operation_state: str or + ~azure.mgmt.storagesync.models.CloudEndpointChangeEnumerationActivityState + :ivar status_code: When non-zero, indicates an issue that is delaying change enumeration. + :vartype status_code: int + :ivar started_timestamp: Timestamp when change enumeration started. + :vartype started_timestamp: ~datetime.datetime + :ivar processed_files_count: Count of files processed. + :vartype processed_files_count: long + :ivar processed_directories_count: Count of directories processed. + :vartype processed_directories_count: long + :ivar total_files_count: Total count of files enumerated. + :vartype total_files_count: long + :ivar total_directories_count: Total count of directories enumerated. + :vartype total_directories_count: long + :ivar total_size_bytes: Total enumerated size in bytes. + :vartype total_size_bytes: long + :ivar progress_percent: Progress percentage for change enumeration run, excluding processing of + deletes. + :vartype progress_percent: int + :ivar minutes_remaining: Estimate of time remaining for the enumeration run. + :vartype minutes_remaining: int + :ivar total_counts_state: Change enumeration total counts state. Possible values include: + "Calculating", "Final". + :vartype total_counts_state: str or + ~azure.mgmt.storagesync.models.CloudEndpointChangeEnumerationTotalCountsState + :ivar deletes_progress_percent: Progress percentage for processing deletes. This is done + separately from the rest of the enumeration run. + :vartype deletes_progress_percent: int + """ + + _validation = { + 'last_updated_timestamp': {'readonly': True}, + 'operation_state': {'readonly': True}, + 'status_code': {'readonly': True}, + 'started_timestamp': {'readonly': True}, + 'processed_files_count': {'readonly': True, 'minimum': 0}, + 'processed_directories_count': {'readonly': True, 'minimum': 0}, + 'total_files_count': {'readonly': True, 'minimum': 0}, + 'total_directories_count': {'readonly': True, 'minimum': 0}, + 'total_size_bytes': {'readonly': True, 'minimum': 0}, + 'progress_percent': {'readonly': True, 'maximum': 100, 'minimum': 0}, + 'minutes_remaining': {'readonly': True, 'minimum': 0}, + 'total_counts_state': {'readonly': True}, + 'deletes_progress_percent': {'readonly': True, 'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, + 'operation_state': {'key': 'operationState', 'type': 'str'}, + 'status_code': {'key': 'statusCode', 'type': 'int'}, + 'started_timestamp': {'key': 'startedTimestamp', 'type': 'iso-8601'}, + 'processed_files_count': {'key': 'processedFilesCount', 'type': 'long'}, + 'processed_directories_count': {'key': 'processedDirectoriesCount', 'type': 'long'}, + 'total_files_count': {'key': 'totalFilesCount', 'type': 'long'}, + 'total_directories_count': {'key': 'totalDirectoriesCount', 'type': 'long'}, + 'total_size_bytes': {'key': 'totalSizeBytes', 'type': 'long'}, + 'progress_percent': {'key': 'progressPercent', 'type': 'int'}, + 'minutes_remaining': {'key': 'minutesRemaining', 'type': 'int'}, + 'total_counts_state': {'key': 'totalCountsState', 'type': 'str'}, + 'deletes_progress_percent': {'key': 'deletesProgressPercent', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(CloudEndpointChangeEnumerationActivity, self).__init__(**kwargs) + self.last_updated_timestamp = None + self.operation_state = None + self.status_code = None + self.started_timestamp = None + self.processed_files_count = None + self.processed_directories_count = None + self.total_files_count = None + self.total_directories_count = None + self.total_size_bytes = None + self.progress_percent = None + self.minutes_remaining = None + self.total_counts_state = None + self.deletes_progress_percent = None + + +class CloudEndpointChangeEnumerationStatus(msrest.serialization.Model): + """Cloud endpoint change enumeration status object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar last_enumeration_status: Status of last completed change enumeration. + :vartype last_enumeration_status: + ~azure.mgmt.storagesync.models.CloudEndpointLastChangeEnumerationStatus + :ivar activity: Change enumeration activity. + :vartype activity: ~azure.mgmt.storagesync.models.CloudEndpointChangeEnumerationActivity + """ + + _validation = { + 'last_updated_timestamp': {'readonly': True}, + 'last_enumeration_status': {'readonly': True}, + 'activity': {'readonly': True}, + } + + _attribute_map = { + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, + 'last_enumeration_status': {'key': 'lastEnumerationStatus', 'type': 'CloudEndpointLastChangeEnumerationStatus'}, + 'activity': {'key': 'activity', 'type': 'CloudEndpointChangeEnumerationActivity'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(CloudEndpointChangeEnumerationStatus, self).__init__(**kwargs) + self.last_updated_timestamp = None + self.last_enumeration_status = None + self.activity = None + + class CloudEndpointCreateParameters(ProxyResource): """The parameters used when creating a cloud endpoint. @@ -296,26 +485,31 @@ class CloudEndpointCreateParameters(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param storage_account_resource_id: Storage Account Resource Id. - :type storage_account_resource_id: str - :param azure_file_share_name: Azure file share name. - :type azure_file_share_name: str - :param storage_account_tenant_id: Storage Account Tenant Id. - :type storage_account_tenant_id: str - :param friendly_name: Friendly Name. - :type friendly_name: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar storage_account_resource_id: Storage Account Resource Id. + :vartype storage_account_resource_id: str + :ivar azure_file_share_name: Azure file share name. + :vartype azure_file_share_name: str + :ivar storage_account_tenant_id: Storage Account Tenant Id. + :vartype storage_account_tenant_id: str + :ivar friendly_name: Friendly Name. + :vartype friendly_name: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, 'azure_file_share_name': {'key': 'properties.azureFileShareName', 'type': 'str'}, 'storage_account_tenant_id': {'key': 'properties.storageAccountTenantId', 'type': 'str'}, @@ -331,6 +525,16 @@ def __init__( friendly_name: Optional[str] = None, **kwargs ): + """ + :keyword storage_account_resource_id: Storage Account Resource Id. + :paramtype storage_account_resource_id: str + :keyword azure_file_share_name: Azure file share name. + :paramtype azure_file_share_name: str + :keyword storage_account_tenant_id: Storage Account Tenant Id. + :paramtype storage_account_tenant_id: str + :keyword friendly_name: Friendly Name. + :paramtype friendly_name: str + """ super(CloudEndpointCreateParameters, self).__init__(**kwargs) self.storage_account_resource_id = storage_account_resource_id self.azure_file_share_name = azure_file_share_name @@ -338,6 +542,58 @@ def __init__( self.friendly_name = friendly_name +class CloudEndpointLastChangeEnumerationStatus(msrest.serialization.Model): + """Cloud endpoint change enumeration status object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar started_timestamp: Timestamp when change enumeration started. + :vartype started_timestamp: ~datetime.datetime + :ivar completed_timestamp: Timestamp when change enumeration completed. + :vartype completed_timestamp: ~datetime.datetime + :ivar namespace_files_count: Count of files in the namespace. + :vartype namespace_files_count: long + :ivar namespace_directories_count: Count of directories in the namespace. + :vartype namespace_directories_count: long + :ivar namespace_size_bytes: Namespace size in bytes. + :vartype namespace_size_bytes: long + :ivar next_run_timestamp: Timestamp of when change enumeration is expected to run again. + :vartype next_run_timestamp: ~datetime.datetime + """ + + _validation = { + 'started_timestamp': {'readonly': True}, + 'completed_timestamp': {'readonly': True}, + 'namespace_files_count': {'readonly': True, 'minimum': 0}, + 'namespace_directories_count': {'readonly': True, 'minimum': 0}, + 'namespace_size_bytes': {'readonly': True, 'minimum': 0}, + 'next_run_timestamp': {'readonly': True}, + } + + _attribute_map = { + 'started_timestamp': {'key': 'startedTimestamp', 'type': 'iso-8601'}, + 'completed_timestamp': {'key': 'completedTimestamp', 'type': 'iso-8601'}, + 'namespace_files_count': {'key': 'namespaceFilesCount', 'type': 'long'}, + 'namespace_directories_count': {'key': 'namespaceDirectoriesCount', 'type': 'long'}, + 'namespace_size_bytes': {'key': 'namespaceSizeBytes', 'type': 'long'}, + 'next_run_timestamp': {'key': 'nextRunTimestamp', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(CloudEndpointLastChangeEnumerationStatus, self).__init__(**kwargs) + self.started_timestamp = None + self.completed_timestamp = None + self.namespace_files_count = None + self.namespace_directories_count = None + self.namespace_size_bytes = None + self.next_run_timestamp = None + + class CloudTieringCachePerformance(msrest.serialization.Model): """Server endpoint cloud tiering status object. @@ -372,6 +628,8 @@ def __init__( self, **kwargs ): + """ + """ super(CloudTieringCachePerformance, self).__init__(**kwargs) self.last_updated_timestamp = None self.cache_hit_bytes = None @@ -404,6 +662,8 @@ def __init__( self, **kwargs ): + """ + """ super(CloudTieringDatePolicyStatus, self).__init__(**kwargs) self.last_updated_timestamp = None self.tiered_files_most_recent_access_timestamp = None @@ -438,6 +698,8 @@ def __init__( self, **kwargs ): + """ + """ super(CloudTieringFilesNotTiering, self).__init__(**kwargs) self.last_updated_timestamp = None self.total_file_count = None @@ -485,6 +747,8 @@ def __init__( self, **kwargs ): + """ + """ super(CloudTieringSpaceSavings, self).__init__(**kwargs) self.last_updated_timestamp = None self.volume_size_bytes = None @@ -524,6 +788,8 @@ def __init__( self, **kwargs ): + """ + """ super(CloudTieringVolumeFreeSpacePolicyStatus, self).__init__(**kwargs) self.last_updated_timestamp = None self.effective_volume_free_space_policy = None @@ -555,22 +821,81 @@ def __init__( self, **kwargs ): + """ + """ super(FilesNotTieringError, self).__init__(**kwargs) self.error_code = None self.file_count = None +class LocationOperationStatus(msrest.serialization.Model): + """Operation status object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Operation resource Id. + :vartype id: str + :ivar name: Operation Id. + :vartype name: str + :ivar status: Operation status. + :vartype status: str + :ivar start_time: Start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: End time of the operation. + :vartype end_time: ~datetime.datetime + :ivar error: Error details. + :vartype error: ~azure.mgmt.storagesync.models.StorageSyncApiError + :ivar percent_complete: Percent complete. + :vartype percent_complete: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'status': {'readonly': True}, + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'error': {'readonly': True}, + 'percent_complete': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'error': {'key': 'error', 'type': 'StorageSyncApiError'}, + 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(LocationOperationStatus, self).__init__(**kwargs) + self.id = None + self.name = None + self.status = None + self.start_time = None + self.end_time = None + self.error = None + self.percent_complete = None + + class OperationDisplayInfo(msrest.serialization.Model): """The operation supported by storage sync. - :param description: The description of the operation. - :type description: str - :param operation: The action that users can perform, based on their permission level. - :type operation: str - :param provider: Service provider: Microsoft StorageSync. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str + :ivar description: The description of the operation. + :vartype description: str + :ivar operation: The action that users can perform, based on their permission level. + :vartype operation: str + :ivar provider: Service provider: Microsoft StorageSync. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str """ _attribute_map = { @@ -589,6 +914,16 @@ def __init__( resource: Optional[str] = None, **kwargs ): + """ + :keyword description: The description of the operation. + :paramtype description: str + :keyword operation: The action that users can perform, based on their permission level. + :paramtype operation: str + :keyword provider: Service provider: Microsoft StorageSync. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + """ super(OperationDisplayInfo, self).__init__(**kwargs) self.description = description self.operation = operation @@ -599,14 +934,14 @@ def __init__( class OperationDisplayResource(msrest.serialization.Model): """Operation Display Resource object. - :param provider: Operation Display Resource Provider. - :type provider: str - :param resource: Operation Display Resource. - :type resource: str - :param operation: Operation Display Resource Operation. - :type operation: str - :param description: Operation Display Resource Description. - :type description: str + :ivar provider: Operation Display Resource Provider. + :vartype provider: str + :ivar resource: Operation Display Resource. + :vartype resource: str + :ivar operation: Operation Display Resource Operation. + :vartype operation: str + :ivar description: Operation Display Resource Description. + :vartype description: str """ _attribute_map = { @@ -625,6 +960,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Operation Display Resource Provider. + :paramtype provider: str + :keyword resource: Operation Display Resource. + :paramtype resource: str + :keyword operation: Operation Display Resource Operation. + :paramtype operation: str + :keyword description: Operation Display Resource Description. + :paramtype description: str + """ super(OperationDisplayResource, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -635,14 +980,14 @@ def __init__( class OperationEntity(msrest.serialization.Model): """The operation supported by storage sync. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The operation supported by storage sync. - :type display: ~azure.mgmt.storagesync.models.OperationDisplayInfo - :param origin: The origin. - :type origin: str - :param properties: Properties of the operations resource. - :type properties: ~azure.mgmt.storagesync.models.OperationProperties + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The operation supported by storage sync. + :vartype display: ~azure.mgmt.storagesync.models.OperationDisplayInfo + :ivar origin: The origin. + :vartype origin: str + :ivar properties: Properties of the operations resource. + :vartype properties: ~azure.mgmt.storagesync.models.OperationProperties """ _attribute_map = { @@ -661,6 +1006,16 @@ def __init__( properties: Optional["OperationProperties"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The operation supported by storage sync. + :paramtype display: ~azure.mgmt.storagesync.models.OperationDisplayInfo + :keyword origin: The origin. + :paramtype origin: str + :keyword properties: Properties of the operations resource. + :paramtype properties: ~azure.mgmt.storagesync.models.OperationProperties + """ super(OperationEntity, self).__init__(**kwargs) self.name = name self.display = display @@ -671,10 +1026,10 @@ def __init__( class OperationEntityListResult(msrest.serialization.Model): """The list of storage sync operations. - :param next_link: The link used to get the next page of operations. - :type next_link: str - :param value: The list of operations. - :type value: list[~azure.mgmt.storagesync.models.OperationEntity] + :ivar next_link: The link used to get the next page of operations. + :vartype next_link: str + :ivar value: The list of operations. + :vartype value: list[~azure.mgmt.storagesync.models.OperationEntity] """ _attribute_map = { @@ -689,6 +1044,12 @@ def __init__( value: Optional[List["OperationEntity"]] = None, **kwargs ): + """ + :keyword next_link: The link used to get the next page of operations. + :paramtype next_link: str + :keyword value: The list of operations. + :paramtype value: list[~azure.mgmt.storagesync.models.OperationEntity] + """ super(OperationEntityListResult, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -697,8 +1058,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Properties of the operations resource. - :param service_specification: Service specification for the operations resource. - :type service_specification: + :ivar service_specification: Service specification for the operations resource. + :vartype service_specification: ~azure.mgmt.storagesync.models.OperationResourceServiceSpecification """ @@ -712,6 +1073,11 @@ def __init__( service_specification: Optional["OperationResourceServiceSpecification"] = None, **kwargs ): + """ + :keyword service_specification: Service specification for the operations resource. + :paramtype service_specification: + ~azure.mgmt.storagesync.models.OperationResourceServiceSpecification + """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -719,20 +1085,22 @@ def __init__( class OperationResourceMetricSpecification(msrest.serialization.Model): """Operation Display Resource object. - :param name: Name of the metric. - :type name: str - :param display_name: Display name for the metric. - :type display_name: str - :param display_description: Display description for the metric. - :type display_description: str - :param unit: Unit for the metric. - :type unit: str - :param aggregation_type: Aggregation type for the metric. - :type aggregation_type: str - :param fill_gap_with_zero: Fill gaps in the metric with zero. - :type fill_gap_with_zero: bool - :param dimensions: Dimensions for the metric specification. - :type dimensions: + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Display name for the metric. + :vartype display_name: str + :ivar display_description: Display description for the metric. + :vartype display_description: str + :ivar unit: Unit for the metric. + :vartype unit: str + :ivar aggregation_type: Aggregation type for the metric. + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types for the metric. + :vartype supported_aggregation_types: list[str] + :ivar fill_gap_with_zero: Fill gaps in the metric with zero. + :vartype fill_gap_with_zero: bool + :ivar dimensions: Dimensions for the metric specification. + :vartype dimensions: list[~azure.mgmt.storagesync.models.OperationResourceMetricSpecificationDimension] """ @@ -742,6 +1110,7 @@ class OperationResourceMetricSpecification(msrest.serialization.Model): 'display_description': {'key': 'displayDescription', 'type': 'str'}, 'unit': {'key': 'unit', 'type': 'str'}, 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, 'dimensions': {'key': 'dimensions', 'type': '[OperationResourceMetricSpecificationDimension]'}, } @@ -754,16 +1123,37 @@ def __init__( display_description: Optional[str] = None, unit: Optional[str] = None, aggregation_type: Optional[str] = None, + supported_aggregation_types: Optional[List[str]] = None, fill_gap_with_zero: Optional[bool] = None, dimensions: Optional[List["OperationResourceMetricSpecificationDimension"]] = None, **kwargs ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Display name for the metric. + :paramtype display_name: str + :keyword display_description: Display description for the metric. + :paramtype display_description: str + :keyword unit: Unit for the metric. + :paramtype unit: str + :keyword aggregation_type: Aggregation type for the metric. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Supported aggregation types for the metric. + :paramtype supported_aggregation_types: list[str] + :keyword fill_gap_with_zero: Fill gaps in the metric with zero. + :paramtype fill_gap_with_zero: bool + :keyword dimensions: Dimensions for the metric specification. + :paramtype dimensions: + list[~azure.mgmt.storagesync.models.OperationResourceMetricSpecificationDimension] + """ super(OperationResourceMetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name self.display_description = display_description self.unit = unit self.aggregation_type = aggregation_type + self.supported_aggregation_types = supported_aggregation_types self.fill_gap_with_zero = fill_gap_with_zero self.dimensions = dimensions @@ -771,12 +1161,12 @@ def __init__( class OperationResourceMetricSpecificationDimension(msrest.serialization.Model): """OperationResourceMetricSpecificationDimension object. - :param name: Name of the dimension. - :type name: str - :param display_name: Display name of the dimensions. - :type display_name: str - :param to_be_exported_for_shoebox: Indicates metric should be exported for Shoebox. - :type to_be_exported_for_shoebox: bool + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Display name of the dimensions. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Indicates metric should be exported for Shoebox. + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -793,6 +1183,14 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Display name of the dimensions. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Indicates metric should be exported for Shoebox. + :paramtype to_be_exported_for_shoebox: bool + """ super(OperationResourceMetricSpecificationDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -802,8 +1200,8 @@ def __init__( class OperationResourceServiceSpecification(msrest.serialization.Model): """Service specification. - :param metric_specifications: List of metric specifications. - :type metric_specifications: + :ivar metric_specifications: List of metric specifications. + :vartype metric_specifications: list[~azure.mgmt.storagesync.models.OperationResourceMetricSpecification] """ @@ -817,6 +1215,11 @@ def __init__( metric_specifications: Optional[List["OperationResourceMetricSpecification"]] = None, **kwargs ): + """ + :keyword metric_specifications: List of metric specifications. + :paramtype metric_specifications: + list[~azure.mgmt.storagesync.models.OperationResourceMetricSpecification] + """ super(OperationResourceServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -858,6 +1261,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationStatus, self).__init__(**kwargs) self.name = None self.status = None @@ -887,6 +1292,8 @@ def __init__( self, **kwargs ): + """ + """ super(PostBackupResponse, self).__init__(**kwargs) self.cloud_endpoint_name = None @@ -894,22 +1301,22 @@ def __init__( class PostRestoreRequest(msrest.serialization.Model): """Post Restore Request. - :param partition: Post Restore partition. - :type partition: str - :param replica_group: Post Restore replica group. - :type replica_group: str - :param request_id: Post Restore request id. - :type request_id: str - :param azure_file_share_uri: Post Restore Azure file share uri. - :type azure_file_share_uri: str - :param status: Post Restore Azure status. - :type status: str - :param source_azure_file_share_uri: Post Restore Azure source azure file share uri. - :type source_azure_file_share_uri: str - :param failed_file_list: Post Restore Azure failed file list. - :type failed_file_list: str - :param restore_file_spec: Post Restore restore file spec array. - :type restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] + :ivar partition: Post Restore partition. + :vartype partition: str + :ivar replica_group: Post Restore replica group. + :vartype replica_group: str + :ivar request_id: Post Restore request id. + :vartype request_id: str + :ivar azure_file_share_uri: Post Restore Azure file share uri. + :vartype azure_file_share_uri: str + :ivar status: Post Restore Azure status. + :vartype status: str + :ivar source_azure_file_share_uri: Post Restore Azure source azure file share uri. + :vartype source_azure_file_share_uri: str + :ivar failed_file_list: Post Restore Azure failed file list. + :vartype failed_file_list: str + :ivar restore_file_spec: Post Restore restore file spec array. + :vartype restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] """ _attribute_map = { @@ -936,6 +1343,24 @@ def __init__( restore_file_spec: Optional[List["RestoreFileSpec"]] = None, **kwargs ): + """ + :keyword partition: Post Restore partition. + :paramtype partition: str + :keyword replica_group: Post Restore replica group. + :paramtype replica_group: str + :keyword request_id: Post Restore request id. + :paramtype request_id: str + :keyword azure_file_share_uri: Post Restore Azure file share uri. + :paramtype azure_file_share_uri: str + :keyword status: Post Restore Azure status. + :paramtype status: str + :keyword source_azure_file_share_uri: Post Restore Azure source azure file share uri. + :paramtype source_azure_file_share_uri: str + :keyword failed_file_list: Post Restore Azure failed file list. + :paramtype failed_file_list: str + :keyword restore_file_spec: Post Restore restore file spec array. + :paramtype restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] + """ super(PostRestoreRequest, self).__init__(**kwargs) self.partition = partition self.replica_group = replica_group @@ -950,25 +1375,25 @@ def __init__( class PreRestoreRequest(msrest.serialization.Model): """Pre Restore request object. - :param partition: Pre Restore partition. - :type partition: str - :param replica_group: Pre Restore replica group. - :type replica_group: str - :param request_id: Pre Restore request id. - :type request_id: str - :param azure_file_share_uri: Pre Restore Azure file share uri. - :type azure_file_share_uri: str - :param status: Pre Restore Azure status. - :type status: str - :param source_azure_file_share_uri: Pre Restore Azure source azure file share uri. - :type source_azure_file_share_uri: str - :param backup_metadata_property_bag: Pre Restore backup metadata property bag. - :type backup_metadata_property_bag: str - :param restore_file_spec: Pre Restore restore file spec array. - :type restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] - :param pause_wait_for_sync_drain_time_period_in_seconds: Pre Restore pause wait for sync drain + :ivar partition: Pre Restore partition. + :vartype partition: str + :ivar replica_group: Pre Restore replica group. + :vartype replica_group: str + :ivar request_id: Pre Restore request id. + :vartype request_id: str + :ivar azure_file_share_uri: Pre Restore Azure file share uri. + :vartype azure_file_share_uri: str + :ivar status: Pre Restore Azure status. + :vartype status: str + :ivar source_azure_file_share_uri: Pre Restore Azure source azure file share uri. + :vartype source_azure_file_share_uri: str + :ivar backup_metadata_property_bag: Pre Restore backup metadata property bag. + :vartype backup_metadata_property_bag: str + :ivar restore_file_spec: Pre Restore restore file spec array. + :vartype restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] + :ivar pause_wait_for_sync_drain_time_period_in_seconds: Pre Restore pause wait for sync drain time period in seconds. - :type pause_wait_for_sync_drain_time_period_in_seconds: int + :vartype pause_wait_for_sync_drain_time_period_in_seconds: int """ _attribute_map = { @@ -997,6 +1422,27 @@ def __init__( pause_wait_for_sync_drain_time_period_in_seconds: Optional[int] = None, **kwargs ): + """ + :keyword partition: Pre Restore partition. + :paramtype partition: str + :keyword replica_group: Pre Restore replica group. + :paramtype replica_group: str + :keyword request_id: Pre Restore request id. + :paramtype request_id: str + :keyword azure_file_share_uri: Pre Restore Azure file share uri. + :paramtype azure_file_share_uri: str + :keyword status: Pre Restore Azure status. + :paramtype status: str + :keyword source_azure_file_share_uri: Pre Restore Azure source azure file share uri. + :paramtype source_azure_file_share_uri: str + :keyword backup_metadata_property_bag: Pre Restore backup metadata property bag. + :paramtype backup_metadata_property_bag: str + :keyword restore_file_spec: Pre Restore restore file spec array. + :paramtype restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] + :keyword pause_wait_for_sync_drain_time_period_in_seconds: Pre Restore pause wait for sync + drain time period in seconds. + :paramtype pause_wait_for_sync_drain_time_period_in_seconds: int + """ super(PreRestoreRequest, self).__init__(**kwargs) self.partition = partition self.replica_group = replica_group @@ -1030,6 +1476,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -1047,11 +1495,14 @@ class PrivateEndpointConnection(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.storagesync.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.storagesync.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: ~azure.mgmt.storagesync.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of the private endpoint connection resource. Possible values include: "Succeeded", "Creating", "Deleting", "Failed". @@ -1063,6 +1514,7 @@ class PrivateEndpointConnection(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -1070,6 +1522,7 @@ class PrivateEndpointConnection(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -1082,6 +1535,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.storagesync.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.storagesync.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -1091,8 +1552,8 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """List of private endpoint connection associated with the specified storage account. - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.storagesync.models.PrivateEndpointConnection] + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.storagesync.models.PrivateEndpointConnection] """ _attribute_map = { @@ -1105,6 +1566,10 @@ def __init__( value: Optional[List["PrivateEndpointConnection"]] = None, **kwargs ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.storagesync.models.PrivateEndpointConnection] + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value @@ -1122,18 +1587,22 @@ class PrivateLinkResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData :ivar group_id: The private link resource group id. :vartype group_id: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, 'group_id': {'readonly': True}, 'required_members': {'readonly': True}, } @@ -1142,6 +1611,7 @@ class PrivateLinkResource(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'group_id': {'key': 'properties.groupId', 'type': 'str'}, 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, @@ -1153,6 +1623,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = None self.required_members = None @@ -1162,8 +1636,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.storagesync.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.storagesync.models.PrivateLinkResource] """ _attribute_map = { @@ -1176,6 +1650,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.storagesync.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -1183,14 +1661,14 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or ~azure.mgmt.storagesync.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :vartype status: str or ~azure.mgmt.storagesync.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type actions_required: str + :vartype actions_required: str """ _attribute_map = { @@ -1207,6 +1685,16 @@ def __init__( actions_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected". + :paramtype status: str or ~azure.mgmt.storagesync.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -1216,10 +1704,10 @@ def __init__( class RecallActionParameters(msrest.serialization.Model): """The parameters used when calling recall action on server endpoint. - :param pattern: Pattern of the files. - :type pattern: str - :param recall_path: Recall path. - :type recall_path: str + :ivar pattern: Pattern of the files. + :vartype pattern: str + :ivar recall_path: Recall path. + :vartype recall_path: str """ _attribute_map = { @@ -1234,6 +1722,12 @@ def __init__( recall_path: Optional[str] = None, **kwargs ): + """ + :keyword pattern: Pattern of the files. + :paramtype pattern: str + :keyword recall_path: Recall path. + :paramtype recall_path: str + """ super(RecallActionParameters, self).__init__(**kwargs) self.pattern = pattern self.recall_path = recall_path @@ -1252,32 +1746,35 @@ class RegisteredServer(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param server_certificate: Registered Server Certificate. - :type server_certificate: str - :param agent_version: Registered Server Agent Version. - :type agent_version: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar server_certificate: Registered Server Certificate. + :vartype server_certificate: str + :ivar agent_version: Registered Server Agent Version. + :vartype agent_version: str :ivar agent_version_status: Registered Server Agent Version Status. Possible values include: "Ok", "NearExpiry", "Expired", "Blocked". :vartype agent_version_status: str or ~azure.mgmt.storagesync.models.RegisteredServerAgentVersionStatus :ivar agent_version_expiration_date: Registered Server Agent Version Expiration Date. :vartype agent_version_expiration_date: ~datetime.datetime - :param server_os_version: Registered Server OS Version. - :type server_os_version: str + :ivar server_os_version: Registered Server OS Version. + :vartype server_os_version: str :ivar server_management_error_code: Registered Server Management Error Code. :vartype server_management_error_code: int :ivar last_heart_beat: Registered Server last heart beat. - :vartype last_heart_beat: ~datetime.datetime + :vartype last_heart_beat: str :ivar provisioning_state: Registered Server Provisioning State. :vartype provisioning_state: str - :param server_role: Registered Server serverRole. - :type server_role: str - :param cluster_id: Registered Server clusterId. - :type cluster_id: str - :param cluster_name: Registered Server clusterName. - :type cluster_name: str - :param server_id: Registered Server serverId. - :type server_id: str + :ivar server_role: Registered Server serverRole. + :vartype server_role: str + :ivar cluster_id: Registered Server clusterId. + :vartype cluster_id: str + :ivar cluster_name: Registered Server clusterName. + :vartype cluster_name: str + :ivar server_id: Registered Server serverId. + :vartype server_id: str :ivar storage_sync_service_uid: Registered Server storageSyncServiceUid. :vartype storage_sync_service_uid: str :ivar last_workflow_id: Registered Server lastWorkflowId. @@ -1290,8 +1787,8 @@ class RegisteredServer(ProxyResource): :vartype resource_location: str :ivar service_location: Service Location. :vartype service_location: str - :param friendly_name: Friendly Name. - :type friendly_name: str + :ivar friendly_name: Friendly Name. + :vartype friendly_name: str :ivar management_endpoint_uri: Management Endpoint Uri. :vartype management_endpoint_uri: str :ivar monitoring_endpoint_uri: Telemetry Endpoint Uri. @@ -1306,20 +1803,9 @@ class RegisteredServer(ProxyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, 'agent_version_status': {'readonly': True}, 'agent_version_expiration_date': {'readonly': True}, - 'server_management_error_code': {'readonly': True}, - 'last_heart_beat': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'storage_sync_service_uid': {'readonly': True}, - 'last_workflow_id': {'readonly': True}, - 'last_operation_name': {'readonly': True}, - 'discovery_endpoint_uri': {'readonly': True}, - 'resource_location': {'readonly': True}, - 'service_location': {'readonly': True}, - 'management_endpoint_uri': {'readonly': True}, - 'monitoring_endpoint_uri': {'readonly': True}, - 'monitoring_configuration': {'readonly': True}, 'server_name': {'readonly': True}, } @@ -1327,13 +1813,14 @@ class RegisteredServer(ProxyResource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'server_certificate': {'key': 'properties.serverCertificate', 'type': 'str'}, 'agent_version': {'key': 'properties.agentVersion', 'type': 'str'}, 'agent_version_status': {'key': 'properties.agentVersionStatus', 'type': 'str'}, 'agent_version_expiration_date': {'key': 'properties.agentVersionExpirationDate', 'type': 'iso-8601'}, 'server_os_version': {'key': 'properties.serverOSVersion', 'type': 'str'}, 'server_management_error_code': {'key': 'properties.serverManagementErrorCode', 'type': 'int'}, - 'last_heart_beat': {'key': 'properties.lastHeartBeat', 'type': 'iso-8601'}, + 'last_heart_beat': {'key': 'properties.lastHeartBeat', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'server_role': {'key': 'properties.serverRole', 'type': 'str'}, 'cluster_id': {'key': 'properties.clusterId', 'type': 'str'}, @@ -1358,44 +1845,98 @@ def __init__( server_certificate: Optional[str] = None, agent_version: Optional[str] = None, server_os_version: Optional[str] = None, + server_management_error_code: Optional[int] = None, + last_heart_beat: Optional[str] = None, + provisioning_state: Optional[str] = None, server_role: Optional[str] = None, cluster_id: Optional[str] = None, cluster_name: Optional[str] = None, server_id: Optional[str] = None, + storage_sync_service_uid: Optional[str] = None, + last_workflow_id: Optional[str] = None, + last_operation_name: Optional[str] = None, + discovery_endpoint_uri: Optional[str] = None, + resource_location: Optional[str] = None, + service_location: Optional[str] = None, friendly_name: Optional[str] = None, - **kwargs - ): + management_endpoint_uri: Optional[str] = None, + monitoring_endpoint_uri: Optional[str] = None, + monitoring_configuration: Optional[str] = None, + **kwargs + ): + """ + :keyword server_certificate: Registered Server Certificate. + :paramtype server_certificate: str + :keyword agent_version: Registered Server Agent Version. + :paramtype agent_version: str + :keyword server_os_version: Registered Server OS Version. + :paramtype server_os_version: str + :keyword server_management_error_code: Registered Server Management Error Code. + :paramtype server_management_error_code: int + :keyword last_heart_beat: Registered Server last heart beat. + :paramtype last_heart_beat: str + :keyword provisioning_state: Registered Server Provisioning State. + :paramtype provisioning_state: str + :keyword server_role: Registered Server serverRole. + :paramtype server_role: str + :keyword cluster_id: Registered Server clusterId. + :paramtype cluster_id: str + :keyword cluster_name: Registered Server clusterName. + :paramtype cluster_name: str + :keyword server_id: Registered Server serverId. + :paramtype server_id: str + :keyword storage_sync_service_uid: Registered Server storageSyncServiceUid. + :paramtype storage_sync_service_uid: str + :keyword last_workflow_id: Registered Server lastWorkflowId. + :paramtype last_workflow_id: str + :keyword last_operation_name: Resource Last Operation Name. + :paramtype last_operation_name: str + :keyword discovery_endpoint_uri: Resource discoveryEndpointUri. + :paramtype discovery_endpoint_uri: str + :keyword resource_location: Resource Location. + :paramtype resource_location: str + :keyword service_location: Service Location. + :paramtype service_location: str + :keyword friendly_name: Friendly Name. + :paramtype friendly_name: str + :keyword management_endpoint_uri: Management Endpoint Uri. + :paramtype management_endpoint_uri: str + :keyword monitoring_endpoint_uri: Telemetry Endpoint Uri. + :paramtype monitoring_endpoint_uri: str + :keyword monitoring_configuration: Monitoring Configuration. + :paramtype monitoring_configuration: str + """ super(RegisteredServer, self).__init__(**kwargs) self.server_certificate = server_certificate self.agent_version = agent_version self.agent_version_status = None self.agent_version_expiration_date = None self.server_os_version = server_os_version - self.server_management_error_code = None - self.last_heart_beat = None - self.provisioning_state = None + self.server_management_error_code = server_management_error_code + self.last_heart_beat = last_heart_beat + self.provisioning_state = provisioning_state self.server_role = server_role self.cluster_id = cluster_id self.cluster_name = cluster_name self.server_id = server_id - self.storage_sync_service_uid = None - self.last_workflow_id = None - self.last_operation_name = None - self.discovery_endpoint_uri = None - self.resource_location = None - self.service_location = None + self.storage_sync_service_uid = storage_sync_service_uid + self.last_workflow_id = last_workflow_id + self.last_operation_name = last_operation_name + self.discovery_endpoint_uri = discovery_endpoint_uri + self.resource_location = resource_location + self.service_location = service_location self.friendly_name = friendly_name - self.management_endpoint_uri = None - self.monitoring_endpoint_uri = None - self.monitoring_configuration = None + self.management_endpoint_uri = management_endpoint_uri + self.monitoring_endpoint_uri = monitoring_endpoint_uri + self.monitoring_configuration = monitoring_configuration self.server_name = None class RegisteredServerArray(msrest.serialization.Model): """Array of RegisteredServer. - :param value: Collection of Registered Server. - :type value: list[~azure.mgmt.storagesync.models.RegisteredServer] + :ivar value: Collection of Registered Server. + :vartype value: list[~azure.mgmt.storagesync.models.RegisteredServer] """ _attribute_map = { @@ -1408,6 +1949,10 @@ def __init__( value: Optional[List["RegisteredServer"]] = None, **kwargs ): + """ + :keyword value: Collection of Registered Server. + :paramtype value: list[~azure.mgmt.storagesync.models.RegisteredServer] + """ super(RegisteredServerArray, self).__init__(**kwargs) self.value = value @@ -1425,36 +1970,41 @@ class RegisteredServerCreateParameters(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param server_certificate: Registered Server Certificate. - :type server_certificate: str - :param agent_version: Registered Server Agent Version. - :type agent_version: str - :param server_os_version: Registered Server OS Version. - :type server_os_version: str - :param last_heart_beat: Registered Server last heart beat. - :type last_heart_beat: str - :param server_role: Registered Server serverRole. - :type server_role: str - :param cluster_id: Registered Server clusterId. - :type cluster_id: str - :param cluster_name: Registered Server clusterName. - :type cluster_name: str - :param server_id: Registered Server serverId. - :type server_id: str - :param friendly_name: Friendly Name. - :type friendly_name: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar server_certificate: Registered Server Certificate. + :vartype server_certificate: str + :ivar agent_version: Registered Server Agent Version. + :vartype agent_version: str + :ivar server_os_version: Registered Server OS Version. + :vartype server_os_version: str + :ivar last_heart_beat: Registered Server last heart beat. + :vartype last_heart_beat: str + :ivar server_role: Registered Server serverRole. + :vartype server_role: str + :ivar cluster_id: Registered Server clusterId. + :vartype cluster_id: str + :ivar cluster_name: Registered Server clusterName. + :vartype cluster_name: str + :ivar server_id: Registered Server serverId. + :vartype server_id: str + :ivar friendly_name: Friendly Name. + :vartype friendly_name: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'server_certificate': {'key': 'properties.serverCertificate', 'type': 'str'}, 'agent_version': {'key': 'properties.agentVersion', 'type': 'str'}, 'server_os_version': {'key': 'properties.serverOSVersion', 'type': 'str'}, @@ -1480,6 +2030,26 @@ def __init__( friendly_name: Optional[str] = None, **kwargs ): + """ + :keyword server_certificate: Registered Server Certificate. + :paramtype server_certificate: str + :keyword agent_version: Registered Server Agent Version. + :paramtype agent_version: str + :keyword server_os_version: Registered Server OS Version. + :paramtype server_os_version: str + :keyword last_heart_beat: Registered Server last heart beat. + :paramtype last_heart_beat: str + :keyword server_role: Registered Server serverRole. + :paramtype server_role: str + :keyword cluster_id: Registered Server clusterId. + :paramtype cluster_id: str + :keyword cluster_name: Registered Server clusterName. + :paramtype cluster_name: str + :keyword server_id: Registered Server serverId. + :paramtype server_id: str + :keyword friendly_name: Friendly Name. + :paramtype friendly_name: str + """ super(RegisteredServerCreateParameters, self).__init__(**kwargs) self.server_certificate = server_certificate self.agent_version = agent_version @@ -1495,10 +2065,10 @@ def __init__( class ResourcesMoveInfo(msrest.serialization.Model): """Resource Move Info. - :param target_resource_group: Target resource group. - :type target_resource_group: str - :param resources: Collection of Resources. - :type resources: list[str] + :ivar target_resource_group: Target resource group. + :vartype target_resource_group: str + :ivar resources: Collection of Resources. + :vartype resources: list[str] """ _attribute_map = { @@ -1513,6 +2083,12 @@ def __init__( resources: Optional[List[str]] = None, **kwargs ): + """ + :keyword target_resource_group: Target resource group. + :paramtype target_resource_group: str + :keyword resources: Collection of Resources. + :paramtype resources: list[str] + """ super(ResourcesMoveInfo, self).__init__(**kwargs) self.target_resource_group = target_resource_group self.resources = resources @@ -1521,10 +2097,10 @@ def __init__( class RestoreFileSpec(msrest.serialization.Model): """Restore file spec. - :param path: Restore file spec path. - :type path: str - :param isdir: Restore file spec isdir. - :type isdir: bool + :ivar path: Restore file spec path. + :vartype path: str + :ivar isdir: Restore file spec isdir. + :vartype isdir: bool """ _attribute_map = { @@ -1539,6 +2115,12 @@ def __init__( isdir: Optional[bool] = None, **kwargs ): + """ + :keyword path: Restore file spec path. + :paramtype path: str + :keyword isdir: Restore file spec isdir. + :paramtype isdir: bool + """ super(RestoreFileSpec, self).__init__(**kwargs) self.path = path self.isdir = isdir @@ -1557,19 +2139,22 @@ class ServerEndpoint(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param server_local_path: Server Local path. - :type server_local_path: str - :param cloud_tiering: Cloud Tiering. Possible values include: "on", "off". - :type cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus - :param volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it - is enabled. - :type volume_free_space_percent: int - :param tier_files_older_than_days: Tier files older than days. - :type tier_files_older_than_days: int - :param friendly_name: Friendly Name. - :type friendly_name: str - :param server_resource_id: Server Resource Id. - :type server_resource_id: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar server_local_path: Server Local path. + :vartype server_local_path: str + :ivar cloud_tiering: Cloud Tiering. Possible values include: "on", "off". + :vartype cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus + :ivar volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it is + enabled. + :vartype volume_free_space_percent: int + :ivar tier_files_older_than_days: Tier files older than days. + :vartype tier_files_older_than_days: int + :ivar friendly_name: Friendly Name. + :vartype friendly_name: str + :ivar server_resource_id: Server Resource Id. + :vartype server_resource_id: str :ivar provisioning_state: ServerEndpoint Provisioning State. :vartype provisioning_state: str :ivar last_workflow_id: ServerEndpoint lastWorkflowId. @@ -1578,27 +2163,30 @@ class ServerEndpoint(ProxyResource): :vartype last_operation_name: str :ivar sync_status: Server Endpoint sync status. :vartype sync_status: ~azure.mgmt.storagesync.models.ServerEndpointSyncStatus - :param offline_data_transfer: Offline data transfer. Possible values include: "on", "off". - :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus + :ivar offline_data_transfer: Offline data transfer. Possible values include: "on", "off". + :vartype offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus :ivar offline_data_transfer_storage_account_resource_id: Offline data transfer storage account resource ID. :vartype offline_data_transfer_storage_account_resource_id: str :ivar offline_data_transfer_storage_account_tenant_id: Offline data transfer storage account tenant ID. :vartype offline_data_transfer_storage_account_tenant_id: str - :param offline_data_transfer_share_name: Offline data transfer share name. - :type offline_data_transfer_share_name: str + :ivar offline_data_transfer_share_name: Offline data transfer share name. + :vartype offline_data_transfer_share_name: str :ivar cloud_tiering_status: Cloud tiering status. Only populated if cloud tiering is enabled. :vartype cloud_tiering_status: ~azure.mgmt.storagesync.models.ServerEndpointCloudTieringStatus :ivar recall_status: Recall status. Only populated if cloud tiering is enabled. :vartype recall_status: ~azure.mgmt.storagesync.models.ServerEndpointRecallStatus - :param initial_download_policy: Policy for how namespace and files are recalled during FastDr. + :ivar initial_download_policy: Policy for how namespace and files are recalled during FastDr. Possible values include: "NamespaceOnly", "NamespaceThenModifiedFiles", "AvoidTieredFiles". - :type initial_download_policy: str or ~azure.mgmt.storagesync.models.InitialDownloadPolicy - :param local_cache_mode: Policy for enabling follow-the-sun business models: link local cache - to cloud behavior to pre-populate before local access. Possible values include: + :vartype initial_download_policy: str or ~azure.mgmt.storagesync.models.InitialDownloadPolicy + :ivar local_cache_mode: Policy for enabling follow-the-sun business models: link local cache to + cloud behavior to pre-populate before local access. Possible values include: "DownloadNewAndModifiedFiles", "UpdateLocallyCachedFiles". - :type local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode + :vartype local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode + :ivar initial_upload_policy: Policy for how the initial upload sync session is performed. + Possible values include: "ServerAuthoritative", "Merge". + :vartype initial_upload_policy: str or ~azure.mgmt.storagesync.models.InitialUploadPolicy :ivar server_name: Server name. :vartype server_name: str """ @@ -1607,6 +2195,7 @@ class ServerEndpoint(ProxyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, 'volume_free_space_percent': {'maximum': 100, 'minimum': 0}, 'tier_files_older_than_days': {'maximum': 2147483647, 'minimum': 0}, 'provisioning_state': {'readonly': True}, @@ -1624,6 +2213,7 @@ class ServerEndpoint(ProxyResource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'server_local_path': {'key': 'properties.serverLocalPath', 'type': 'str'}, 'cloud_tiering': {'key': 'properties.cloudTiering', 'type': 'str'}, 'volume_free_space_percent': {'key': 'properties.volumeFreeSpacePercent', 'type': 'int'}, @@ -1642,6 +2232,7 @@ class ServerEndpoint(ProxyResource): 'recall_status': {'key': 'properties.recallStatus', 'type': 'ServerEndpointRecallStatus'}, 'initial_download_policy': {'key': 'properties.initialDownloadPolicy', 'type': 'str'}, 'local_cache_mode': {'key': 'properties.localCacheMode', 'type': 'str'}, + 'initial_upload_policy': {'key': 'properties.initialUploadPolicy', 'type': 'str'}, 'server_name': {'key': 'properties.serverName', 'type': 'str'}, } @@ -1658,8 +2249,39 @@ def __init__( offline_data_transfer_share_name: Optional[str] = None, initial_download_policy: Optional[Union[str, "InitialDownloadPolicy"]] = None, local_cache_mode: Optional[Union[str, "LocalCacheMode"]] = None, - **kwargs - ): + initial_upload_policy: Optional[Union[str, "InitialUploadPolicy"]] = None, + **kwargs + ): + """ + :keyword server_local_path: Server Local path. + :paramtype server_local_path: str + :keyword cloud_tiering: Cloud Tiering. Possible values include: "on", "off". + :paramtype cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus + :keyword volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it + is enabled. + :paramtype volume_free_space_percent: int + :keyword tier_files_older_than_days: Tier files older than days. + :paramtype tier_files_older_than_days: int + :keyword friendly_name: Friendly Name. + :paramtype friendly_name: str + :keyword server_resource_id: Server Resource Id. + :paramtype server_resource_id: str + :keyword offline_data_transfer: Offline data transfer. Possible values include: "on", "off". + :paramtype offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus + :keyword offline_data_transfer_share_name: Offline data transfer share name. + :paramtype offline_data_transfer_share_name: str + :keyword initial_download_policy: Policy for how namespace and files are recalled during + FastDr. Possible values include: "NamespaceOnly", "NamespaceThenModifiedFiles", + "AvoidTieredFiles". + :paramtype initial_download_policy: str or ~azure.mgmt.storagesync.models.InitialDownloadPolicy + :keyword local_cache_mode: Policy for enabling follow-the-sun business models: link local cache + to cloud behavior to pre-populate before local access. Possible values include: + "DownloadNewAndModifiedFiles", "UpdateLocallyCachedFiles". + :paramtype local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode + :keyword initial_upload_policy: Policy for how the initial upload sync session is performed. + Possible values include: "ServerAuthoritative", "Merge". + :paramtype initial_upload_policy: str or ~azure.mgmt.storagesync.models.InitialUploadPolicy + """ super(ServerEndpoint, self).__init__(**kwargs) self.server_local_path = server_local_path self.cloud_tiering = cloud_tiering @@ -1679,14 +2301,15 @@ def __init__( self.recall_status = None self.initial_download_policy = initial_download_policy self.local_cache_mode = local_cache_mode + self.initial_upload_policy = initial_upload_policy self.server_name = None class ServerEndpointArray(msrest.serialization.Model): """Array of ServerEndpoint. - :param value: Collection of ServerEndpoint. - :type value: list[~azure.mgmt.storagesync.models.ServerEndpoint] + :ivar value: Collection of ServerEndpoint. + :vartype value: list[~azure.mgmt.storagesync.models.ServerEndpoint] """ _attribute_map = { @@ -1699,6 +2322,10 @@ def __init__( value: Optional[List["ServerEndpoint"]] = None, **kwargs ): + """ + :keyword value: Collection of ServerEndpoint. + :paramtype value: list[~azure.mgmt.storagesync.models.ServerEndpoint] + """ super(ServerEndpointArray, self).__init__(**kwargs) self.value = value @@ -1710,6 +2337,8 @@ class ServerEndpointBackgroundDataDownloadActivity(msrest.serialization.Model): :ivar timestamp: Timestamp when properties were updated. :vartype timestamp: ~datetime.datetime + :ivar started_timestamp: Timestamp when the operation started. + :vartype started_timestamp: ~datetime.datetime :ivar percent_progress: Progress percentage. :vartype percent_progress: int :ivar downloaded_bytes: Running count of bytes downloaded. @@ -1718,12 +2347,14 @@ class ServerEndpointBackgroundDataDownloadActivity(msrest.serialization.Model): _validation = { 'timestamp': {'readonly': True}, + 'started_timestamp': {'readonly': True}, 'percent_progress': {'readonly': True, 'maximum': 100, 'minimum': 0}, 'downloaded_bytes': {'readonly': True, 'minimum': 0}, } _attribute_map = { 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'started_timestamp': {'key': 'startedTimestamp', 'type': 'iso-8601'}, 'percent_progress': {'key': 'percentProgress', 'type': 'int'}, 'downloaded_bytes': {'key': 'downloadedBytes', 'type': 'long'}, } @@ -1732,8 +2363,11 @@ def __init__( self, **kwargs ): + """ + """ super(ServerEndpointBackgroundDataDownloadActivity, self).__init__(**kwargs) self.timestamp = None + self.started_timestamp = None self.percent_progress = None self.downloaded_bytes = None @@ -1798,6 +2432,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerEndpointCloudTieringStatus, self).__init__(**kwargs) self.last_updated_timestamp = None self.health = None @@ -1824,36 +2460,43 @@ class ServerEndpointCreateParameters(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param server_local_path: Server Local path. - :type server_local_path: str - :param cloud_tiering: Cloud Tiering. Possible values include: "on", "off". - :type cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus - :param volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it - is enabled. - :type volume_free_space_percent: int - :param tier_files_older_than_days: Tier files older than days. - :type tier_files_older_than_days: int - :param friendly_name: Friendly Name. - :type friendly_name: str - :param server_resource_id: Server Resource Id. - :type server_resource_id: str - :param offline_data_transfer: Offline data transfer. Possible values include: "on", "off". - :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus - :param offline_data_transfer_share_name: Offline data transfer share name. - :type offline_data_transfer_share_name: str - :param initial_download_policy: Policy for how namespace and files are recalled during FastDr. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar server_local_path: Server Local path. + :vartype server_local_path: str + :ivar cloud_tiering: Cloud Tiering. Possible values include: "on", "off". + :vartype cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus + :ivar volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it is + enabled. + :vartype volume_free_space_percent: int + :ivar tier_files_older_than_days: Tier files older than days. + :vartype tier_files_older_than_days: int + :ivar friendly_name: Friendly Name. + :vartype friendly_name: str + :ivar server_resource_id: Server Resource Id. + :vartype server_resource_id: str + :ivar offline_data_transfer: Offline data transfer. Possible values include: "on", "off". + :vartype offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus + :ivar offline_data_transfer_share_name: Offline data transfer share name. + :vartype offline_data_transfer_share_name: str + :ivar initial_download_policy: Policy for how namespace and files are recalled during FastDr. Possible values include: "NamespaceOnly", "NamespaceThenModifiedFiles", "AvoidTieredFiles". - :type initial_download_policy: str or ~azure.mgmt.storagesync.models.InitialDownloadPolicy - :param local_cache_mode: Policy for enabling follow-the-sun business models: link local cache - to cloud behavior to pre-populate before local access. Possible values include: + :vartype initial_download_policy: str or ~azure.mgmt.storagesync.models.InitialDownloadPolicy + :ivar local_cache_mode: Policy for enabling follow-the-sun business models: link local cache to + cloud behavior to pre-populate before local access. Possible values include: "DownloadNewAndModifiedFiles", "UpdateLocallyCachedFiles". - :type local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode + :vartype local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode + :ivar initial_upload_policy: Policy for how the initial upload sync session is performed. + Possible values include: "ServerAuthoritative", "Merge". + :vartype initial_upload_policy: str or ~azure.mgmt.storagesync.models.InitialUploadPolicy """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, 'volume_free_space_percent': {'maximum': 100, 'minimum': 0}, 'tier_files_older_than_days': {'maximum': 2147483647, 'minimum': 0}, } @@ -1862,6 +2505,7 @@ class ServerEndpointCreateParameters(ProxyResource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'server_local_path': {'key': 'properties.serverLocalPath', 'type': 'str'}, 'cloud_tiering': {'key': 'properties.cloudTiering', 'type': 'str'}, 'volume_free_space_percent': {'key': 'properties.volumeFreeSpacePercent', 'type': 'int'}, @@ -1872,6 +2516,7 @@ class ServerEndpointCreateParameters(ProxyResource): 'offline_data_transfer_share_name': {'key': 'properties.offlineDataTransferShareName', 'type': 'str'}, 'initial_download_policy': {'key': 'properties.initialDownloadPolicy', 'type': 'str'}, 'local_cache_mode': {'key': 'properties.localCacheMode', 'type': 'str'}, + 'initial_upload_policy': {'key': 'properties.initialUploadPolicy', 'type': 'str'}, } def __init__( @@ -1879,16 +2524,47 @@ def __init__( *, server_local_path: Optional[str] = None, cloud_tiering: Optional[Union[str, "FeatureStatus"]] = None, - volume_free_space_percent: Optional[int] = None, - tier_files_older_than_days: Optional[int] = None, + volume_free_space_percent: Optional[int] = 20, + tier_files_older_than_days: Optional[int] = 0, friendly_name: Optional[str] = None, server_resource_id: Optional[str] = None, offline_data_transfer: Optional[Union[str, "FeatureStatus"]] = None, offline_data_transfer_share_name: Optional[str] = None, initial_download_policy: Optional[Union[str, "InitialDownloadPolicy"]] = None, local_cache_mode: Optional[Union[str, "LocalCacheMode"]] = None, - **kwargs - ): + initial_upload_policy: Optional[Union[str, "InitialUploadPolicy"]] = None, + **kwargs + ): + """ + :keyword server_local_path: Server Local path. + :paramtype server_local_path: str + :keyword cloud_tiering: Cloud Tiering. Possible values include: "on", "off". + :paramtype cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus + :keyword volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it + is enabled. + :paramtype volume_free_space_percent: int + :keyword tier_files_older_than_days: Tier files older than days. + :paramtype tier_files_older_than_days: int + :keyword friendly_name: Friendly Name. + :paramtype friendly_name: str + :keyword server_resource_id: Server Resource Id. + :paramtype server_resource_id: str + :keyword offline_data_transfer: Offline data transfer. Possible values include: "on", "off". + :paramtype offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus + :keyword offline_data_transfer_share_name: Offline data transfer share name. + :paramtype offline_data_transfer_share_name: str + :keyword initial_download_policy: Policy for how namespace and files are recalled during + FastDr. Possible values include: "NamespaceOnly", "NamespaceThenModifiedFiles", + "AvoidTieredFiles". + :paramtype initial_download_policy: str or ~azure.mgmt.storagesync.models.InitialDownloadPolicy + :keyword local_cache_mode: Policy for enabling follow-the-sun business models: link local cache + to cloud behavior to pre-populate before local access. Possible values include: + "DownloadNewAndModifiedFiles", "UpdateLocallyCachedFiles". + :paramtype local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode + :keyword initial_upload_policy: Policy for how the initial upload sync session is performed. + Possible values include: "ServerAuthoritative", "Merge". + :paramtype initial_upload_policy: str or ~azure.mgmt.storagesync.models.InitialUploadPolicy + """ super(ServerEndpointCreateParameters, self).__init__(**kwargs) self.server_local_path = server_local_path self.cloud_tiering = cloud_tiering @@ -1900,6 +2576,7 @@ def __init__( self.offline_data_transfer_share_name = offline_data_transfer_share_name self.initial_download_policy = initial_download_policy self.local_cache_mode = local_cache_mode + self.initial_upload_policy = initial_upload_policy class ServerEndpointFilesNotSyncingError(msrest.serialization.Model): @@ -1931,6 +2608,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerEndpointFilesNotSyncingError, self).__init__(**kwargs) self.error_code = None self.persistent_count = None @@ -1962,6 +2641,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerEndpointRecallError, self).__init__(**kwargs) self.error_code = None self.count = None @@ -1996,6 +2677,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerEndpointRecallStatus, self).__init__(**kwargs) self.last_updated_timestamp = None self.total_recall_errors_count = None @@ -2022,6 +2705,8 @@ class ServerEndpointSyncActivityStatus(msrest.serialization.Model): :ivar sync_mode: Sync mode. Possible values include: "Regular", "NamespaceDownload", "InitialUpload", "SnapshotUpload", "InitialFullDownload". :vartype sync_mode: str or ~azure.mgmt.storagesync.models.ServerEndpointSyncMode + :ivar session_minutes_remaining: Session minutes remaining (if available). + :vartype session_minutes_remaining: int """ _validation = { @@ -2032,6 +2717,7 @@ class ServerEndpointSyncActivityStatus(msrest.serialization.Model): 'applied_bytes': {'readonly': True, 'minimum': 0}, 'total_bytes': {'readonly': True, 'minimum': 0}, 'sync_mode': {'readonly': True}, + 'session_minutes_remaining': {'readonly': True, 'minimum': 0}, } _attribute_map = { @@ -2042,12 +2728,15 @@ class ServerEndpointSyncActivityStatus(msrest.serialization.Model): 'applied_bytes': {'key': 'appliedBytes', 'type': 'long'}, 'total_bytes': {'key': 'totalBytes', 'type': 'long'}, 'sync_mode': {'key': 'syncMode', 'type': 'str'}, + 'session_minutes_remaining': {'key': 'sessionMinutesRemaining', 'type': 'int'}, } def __init__( self, **kwargs ): + """ + """ super(ServerEndpointSyncActivityStatus, self).__init__(**kwargs) self.timestamp = None self.per_item_error_count = None @@ -2056,6 +2745,7 @@ def __init__( self.applied_bytes = None self.total_bytes = None self.sync_mode = None + self.session_minutes_remaining = None class ServerEndpointSyncSessionStatus(msrest.serialization.Model): @@ -2109,6 +2799,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerEndpointSyncSessionStatus, self).__init__(**kwargs) self.last_sync_result = None self.last_sync_timestamp = None @@ -2193,6 +2885,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerEndpointSyncStatus, self).__init__(**kwargs) self.download_health = None self.upload_health = None @@ -2211,21 +2905,21 @@ def __init__( class ServerEndpointUpdateParameters(msrest.serialization.Model): """Parameters for updating an Server Endpoint. - :param cloud_tiering: Cloud Tiering. Possible values include: "on", "off". - :type cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus - :param volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it - is enabled. - :type volume_free_space_percent: int - :param tier_files_older_than_days: Tier files older than days. - :type tier_files_older_than_days: int - :param offline_data_transfer: Offline data transfer. Possible values include: "on", "off". - :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus - :param offline_data_transfer_share_name: Offline data transfer share name. - :type offline_data_transfer_share_name: str - :param local_cache_mode: Policy for enabling follow-the-sun business models: link local cache - to cloud behavior to pre-populate before local access. Possible values include: + :ivar cloud_tiering: Cloud Tiering. Possible values include: "on", "off". + :vartype cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus + :ivar volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it is + enabled. + :vartype volume_free_space_percent: int + :ivar tier_files_older_than_days: Tier files older than days. + :vartype tier_files_older_than_days: int + :ivar offline_data_transfer: Offline data transfer. Possible values include: "on", "off". + :vartype offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus + :ivar offline_data_transfer_share_name: Offline data transfer share name. + :vartype offline_data_transfer_share_name: str + :ivar local_cache_mode: Policy for enabling follow-the-sun business models: link local cache to + cloud behavior to pre-populate before local access. Possible values include: "DownloadNewAndModifiedFiles", "UpdateLocallyCachedFiles". - :type local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode + :vartype local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode """ _validation = { @@ -2253,6 +2947,23 @@ def __init__( local_cache_mode: Optional[Union[str, "LocalCacheMode"]] = None, **kwargs ): + """ + :keyword cloud_tiering: Cloud Tiering. Possible values include: "on", "off". + :paramtype cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus + :keyword volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it + is enabled. + :paramtype volume_free_space_percent: int + :keyword tier_files_older_than_days: Tier files older than days. + :paramtype tier_files_older_than_days: int + :keyword offline_data_transfer: Offline data transfer. Possible values include: "on", "off". + :paramtype offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus + :keyword offline_data_transfer_share_name: Offline data transfer share name. + :paramtype offline_data_transfer_share_name: str + :keyword local_cache_mode: Policy for enabling follow-the-sun business models: link local cache + to cloud behavior to pre-populate before local access. Possible values include: + "DownloadNewAndModifiedFiles", "UpdateLocallyCachedFiles". + :paramtype local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode + """ super(ServerEndpointUpdateParameters, self).__init__(**kwargs) self.cloud_tiering = cloud_tiering self.volume_free_space_percent = volume_free_space_percent @@ -2265,16 +2976,16 @@ def __init__( class StorageSyncApiError(msrest.serialization.Model): """Error type. - :param code: Error code of the given entry. - :type code: str - :param message: Error message of the given entry. - :type message: str - :param target: Target of the given error entry. - :type target: str - :param details: Error details of the given entry. - :type details: ~azure.mgmt.storagesync.models.StorageSyncErrorDetails - :param inner_error: Inner error details of the given entry. - :type inner_error: ~azure.mgmt.storagesync.models.StorageSyncInnerErrorDetails + :ivar code: Error code of the given entry. + :vartype code: str + :ivar message: Error message of the given entry. + :vartype message: str + :ivar target: Target of the given error entry. + :vartype target: str + :ivar details: Error details of the given entry. + :vartype details: ~azure.mgmt.storagesync.models.StorageSyncErrorDetails + :ivar innererror: Inner error details of the given entry. + :vartype innererror: ~azure.mgmt.storagesync.models.StorageSyncInnerErrorDetails """ _attribute_map = { @@ -2282,7 +2993,7 @@ class StorageSyncApiError(msrest.serialization.Model): 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, 'details': {'key': 'details', 'type': 'StorageSyncErrorDetails'}, - 'inner_error': {'key': 'innerError', 'type': 'StorageSyncInnerErrorDetails'}, + 'innererror': {'key': 'innererror', 'type': 'StorageSyncInnerErrorDetails'}, } def __init__( @@ -2292,24 +3003,36 @@ def __init__( message: Optional[str] = None, target: Optional[str] = None, details: Optional["StorageSyncErrorDetails"] = None, - inner_error: Optional["StorageSyncInnerErrorDetails"] = None, - **kwargs - ): + innererror: Optional["StorageSyncInnerErrorDetails"] = None, + **kwargs + ): + """ + :keyword code: Error code of the given entry. + :paramtype code: str + :keyword message: Error message of the given entry. + :paramtype message: str + :keyword target: Target of the given error entry. + :paramtype target: str + :keyword details: Error details of the given entry. + :paramtype details: ~azure.mgmt.storagesync.models.StorageSyncErrorDetails + :keyword innererror: Inner error details of the given entry. + :paramtype innererror: ~azure.mgmt.storagesync.models.StorageSyncInnerErrorDetails + """ super(StorageSyncApiError, self).__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details - self.inner_error = inner_error + self.innererror = innererror class StorageSyncError(msrest.serialization.Model): """Error type. - :param error: Error details of the given entry. - :type error: ~azure.mgmt.storagesync.models.StorageSyncApiError - :param innererror: Error details of the given entry. - :type innererror: ~azure.mgmt.storagesync.models.StorageSyncApiError + :ivar error: Error details of the given entry. + :vartype error: ~azure.mgmt.storagesync.models.StorageSyncApiError + :ivar innererror: Error details of the given entry. + :vartype innererror: ~azure.mgmt.storagesync.models.StorageSyncApiError """ _attribute_map = { @@ -2324,6 +3047,12 @@ def __init__( innererror: Optional["StorageSyncApiError"] = None, **kwargs ): + """ + :keyword error: Error details of the given entry. + :paramtype error: ~azure.mgmt.storagesync.models.StorageSyncApiError + :keyword innererror: Error details of the given entry. + :paramtype innererror: ~azure.mgmt.storagesync.models.StorageSyncApiError + """ super(StorageSyncError, self).__init__(**kwargs) self.error = error self.innererror = innererror @@ -2332,22 +3061,22 @@ def __init__( class StorageSyncErrorDetails(msrest.serialization.Model): """Error Details object. - :param code: Error code of the given entry. - :type code: str - :param message: Error message of the given entry. - :type message: str - :param target: Target of the given entry. - :type target: str - :param request_uri: Request URI of the given entry. - :type request_uri: str - :param exception_type: Exception type of the given entry. - :type exception_type: str - :param http_method: HTTP method of the given entry. - :type http_method: str - :param hashed_message: Hashed message of the given entry. - :type hashed_message: str - :param http_error_code: HTTP error code of the given entry. - :type http_error_code: str + :ivar code: Error code of the given entry. + :vartype code: str + :ivar message: Error message of the given entry. + :vartype message: str + :ivar target: Target of the given entry. + :vartype target: str + :ivar request_uri: Request URI of the given entry. + :vartype request_uri: str + :ivar exception_type: Exception type of the given entry. + :vartype exception_type: str + :ivar http_method: HTTP method of the given entry. + :vartype http_method: str + :ivar hashed_message: Hashed message of the given entry. + :vartype hashed_message: str + :ivar http_error_code: HTTP error code of the given entry. + :vartype http_error_code: str """ _attribute_map = { @@ -2374,6 +3103,24 @@ def __init__( http_error_code: Optional[str] = None, **kwargs ): + """ + :keyword code: Error code of the given entry. + :paramtype code: str + :keyword message: Error message of the given entry. + :paramtype message: str + :keyword target: Target of the given entry. + :paramtype target: str + :keyword request_uri: Request URI of the given entry. + :paramtype request_uri: str + :keyword exception_type: Exception type of the given entry. + :paramtype exception_type: str + :keyword http_method: HTTP method of the given entry. + :paramtype http_method: str + :keyword hashed_message: Hashed message of the given entry. + :paramtype hashed_message: str + :keyword http_error_code: HTTP error code of the given entry. + :paramtype http_error_code: str + """ super(StorageSyncErrorDetails, self).__init__(**kwargs) self.code = code self.message = message @@ -2388,14 +3135,14 @@ def __init__( class StorageSyncInnerErrorDetails(msrest.serialization.Model): """Error Details object. - :param call_stack: Call stack of the error. - :type call_stack: str - :param message: Error message of the error. - :type message: str - :param inner_exception: Exception of the inner error. - :type inner_exception: str - :param inner_exception_call_stack: Call stack of the inner error. - :type inner_exception_call_stack: str + :ivar call_stack: Call stack of the error. + :vartype call_stack: str + :ivar message: Error message of the error. + :vartype message: str + :ivar inner_exception: Exception of the inner error. + :vartype inner_exception: str + :ivar inner_exception_call_stack: Call stack of the inner error. + :vartype inner_exception_call_stack: str """ _attribute_map = { @@ -2414,6 +3161,16 @@ def __init__( inner_exception_call_stack: Optional[str] = None, **kwargs ): + """ + :keyword call_stack: Call stack of the error. + :paramtype call_stack: str + :keyword message: Error message of the error. + :paramtype message: str + :keyword inner_exception: Exception of the inner error. + :paramtype inner_exception: str + :keyword inner_exception_call_stack: Call stack of the inner error. + :paramtype inner_exception_call_stack: str + """ super(StorageSyncInnerErrorDetails, self).__init__(**kwargs) self.call_stack = call_stack self.message = message @@ -2436,16 +3193,20 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, 'location': {'required': True}, } @@ -2453,6 +3214,7 @@ class TrackedResource(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, } @@ -2464,6 +3226,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -2484,13 +3252,16 @@ class StorageSyncService(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param incoming_traffic_policy: Incoming Traffic Policy. Possible values include: + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar incoming_traffic_policy: Incoming Traffic Policy. Possible values include: "AllowAllTraffic", "AllowVirtualNetworksOnly". - :type incoming_traffic_policy: str or ~azure.mgmt.storagesync.models.IncomingTrafficPolicy + :vartype incoming_traffic_policy: str or ~azure.mgmt.storagesync.models.IncomingTrafficPolicy :ivar storage_sync_service_status: Storage Sync service status. :vartype storage_sync_service_status: int :ivar storage_sync_service_uid: Storage Sync service Uid. @@ -2511,6 +3282,7 @@ class StorageSyncService(TrackedResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, 'location': {'required': True}, 'storage_sync_service_status': {'readonly': True}, 'storage_sync_service_uid': {'readonly': True}, @@ -2524,6 +3296,7 @@ class StorageSyncService(TrackedResource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, 'incoming_traffic_policy': {'key': 'properties.incomingTrafficPolicy', 'type': 'str'}, @@ -2543,6 +3316,15 @@ def __init__( incoming_traffic_policy: Optional[Union[str, "IncomingTrafficPolicy"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword incoming_traffic_policy: Incoming Traffic Policy. Possible values include: + "AllowAllTraffic", "AllowVirtualNetworksOnly". + :paramtype incoming_traffic_policy: str or ~azure.mgmt.storagesync.models.IncomingTrafficPolicy + """ super(StorageSyncService, self).__init__(tags=tags, location=location, **kwargs) self.incoming_traffic_policy = incoming_traffic_policy self.storage_sync_service_status = None @@ -2556,8 +3338,8 @@ def __init__( class StorageSyncServiceArray(msrest.serialization.Model): """Array of StorageSyncServices. - :param value: Collection of StorageSyncServices. - :type value: list[~azure.mgmt.storagesync.models.StorageSyncService] + :ivar value: Collection of StorageSyncServices. + :vartype value: list[~azure.mgmt.storagesync.models.StorageSyncService] """ _attribute_map = { @@ -2570,6 +3352,10 @@ def __init__( value: Optional[List["StorageSyncService"]] = None, **kwargs ): + """ + :keyword value: Collection of StorageSyncServices. + :paramtype value: list[~azure.mgmt.storagesync.models.StorageSyncService] + """ super(StorageSyncServiceArray, self).__init__(**kwargs) self.value = value @@ -2579,19 +3365,19 @@ class StorageSyncServiceCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + :ivar location: Required. Required. Gets or sets the location of the resource. This will be one + of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype location: str + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param incoming_traffic_policy: Incoming Traffic Policy. Possible values include: + :vartype tags: dict[str, str] + :ivar incoming_traffic_policy: Incoming Traffic Policy. Possible values include: "AllowAllTraffic", "AllowVirtualNetworksOnly". - :type incoming_traffic_policy: str or ~azure.mgmt.storagesync.models.IncomingTrafficPolicy + :vartype incoming_traffic_policy: str or ~azure.mgmt.storagesync.models.IncomingTrafficPolicy """ _validation = { @@ -2612,6 +3398,21 @@ def __init__( incoming_traffic_policy: Optional[Union[str, "IncomingTrafficPolicy"]] = None, **kwargs ): + """ + :keyword location: Required. Required. Gets or sets the location of the resource. This will be + one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + etc.). The geo region of a resource cannot be changed once it is created, but if an identical + geo region is specified on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used for viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a + length no greater than 128 characters and a value with a length no greater than 256 characters. + :paramtype tags: dict[str, str] + :keyword incoming_traffic_policy: Incoming Traffic Policy. Possible values include: + "AllowAllTraffic", "AllowVirtualNetworksOnly". + :paramtype incoming_traffic_policy: str or ~azure.mgmt.storagesync.models.IncomingTrafficPolicy + """ super(StorageSyncServiceCreateParameters, self).__init__(**kwargs) self.location = location self.tags = tags @@ -2621,11 +3422,11 @@ def __init__( class StorageSyncServiceUpdateParameters(msrest.serialization.Model): """Parameters for updating an Storage sync service. - :param tags: A set of tags. The user-specified tags associated with the storage sync service. - :type tags: dict[str, str] - :param incoming_traffic_policy: Incoming Traffic Policy. Possible values include: + :ivar tags: A set of tags. The user-specified tags associated with the storage sync service. + :vartype tags: dict[str, str] + :ivar incoming_traffic_policy: Incoming Traffic Policy. Possible values include: "AllowAllTraffic", "AllowVirtualNetworksOnly". - :type incoming_traffic_policy: str or ~azure.mgmt.storagesync.models.IncomingTrafficPolicy + :vartype incoming_traffic_policy: str or ~azure.mgmt.storagesync.models.IncomingTrafficPolicy """ _attribute_map = { @@ -2640,6 +3441,13 @@ def __init__( incoming_traffic_policy: Optional[Union[str, "IncomingTrafficPolicy"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The user-specified tags associated with the storage sync service. + :paramtype tags: dict[str, str] + :keyword incoming_traffic_policy: Incoming Traffic Policy. Possible values include: + "AllowAllTraffic", "AllowVirtualNetworksOnly". + :paramtype incoming_traffic_policy: str or ~azure.mgmt.storagesync.models.IncomingTrafficPolicy + """ super(StorageSyncServiceUpdateParameters, self).__init__(**kwargs) self.tags = tags self.incoming_traffic_policy = incoming_traffic_policy @@ -2650,13 +3458,13 @@ class SubscriptionState(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param state: State of Azure Subscription. Possible values include: "Registered", + :ivar state: State of Azure Subscription. Possible values include: "Registered", "Unregistered", "Warned", "Suspended", "Deleted". - :type state: str or ~azure.mgmt.storagesync.models.Reason + :vartype state: str or ~azure.mgmt.storagesync.models.Reason :ivar istransitioning: Is Transitioning. :vartype istransitioning: bool - :param properties: Subscription state properties. - :type properties: object + :ivar properties: Subscription state properties. + :vartype properties: any """ _validation = { @@ -2673,9 +3481,16 @@ def __init__( self, *, state: Optional[Union[str, "Reason"]] = None, - properties: Optional[object] = None, + properties: Optional[Any] = None, **kwargs ): + """ + :keyword state: State of Azure Subscription. Possible values include: "Registered", + "Unregistered", "Warned", "Suspended", "Deleted". + :paramtype state: str or ~azure.mgmt.storagesync.models.Reason + :keyword properties: Subscription state properties. + :paramtype properties: any + """ super(SubscriptionState, self).__init__(**kwargs) self.state = state self.istransitioning = None @@ -2695,6 +3510,9 @@ class SyncGroup(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData :ivar unique_id: Unique Id. :vartype unique_id: str :ivar sync_group_status: Sync group status. @@ -2705,6 +3523,7 @@ class SyncGroup(ProxyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, 'unique_id': {'readonly': True}, 'sync_group_status': {'readonly': True}, } @@ -2713,6 +3532,7 @@ class SyncGroup(ProxyResource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, 'sync_group_status': {'key': 'properties.syncGroupStatus', 'type': 'str'}, } @@ -2721,6 +3541,8 @@ def __init__( self, **kwargs ): + """ + """ super(SyncGroup, self).__init__(**kwargs) self.unique_id = None self.sync_group_status = None @@ -2729,8 +3551,8 @@ def __init__( class SyncGroupArray(msrest.serialization.Model): """Array of SyncGroup. - :param value: Collection of SyncGroup. - :type value: list[~azure.mgmt.storagesync.models.SyncGroup] + :ivar value: Collection of SyncGroup. + :vartype value: list[~azure.mgmt.storagesync.models.SyncGroup] """ _attribute_map = { @@ -2743,6 +3565,10 @@ def __init__( value: Optional[List["SyncGroup"]] = None, **kwargs ): + """ + :keyword value: Collection of SyncGroup. + :paramtype value: list[~azure.mgmt.storagesync.models.SyncGroup] + """ super(SyncGroupArray, self).__init__(**kwargs) self.value = value @@ -2760,45 +3586,118 @@ class SyncGroupCreateParameters(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param properties: The parameters used to create the sync group. - :type properties: object + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar properties: The parameters used to create the sync group. + :vartype properties: any """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'properties': {'key': 'properties', 'type': 'object'}, } def __init__( self, *, - properties: Optional[object] = None, + properties: Optional[Any] = None, **kwargs ): + """ + :keyword properties: The parameters used to create the sync group. + :paramtype properties: any + """ super(SyncGroupCreateParameters, self).__init__(**kwargs) self.properties = properties +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.storagesync.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.storagesync.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.storagesync.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.storagesync.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + class TriggerChangeDetectionParameters(msrest.serialization.Model): """The parameters used when calling trigger change detection action on cloud endpoint. - :param directory_path: Relative path to a directory Azure File share for which change detection + :ivar directory_path: Relative path to a directory Azure File share for which change detection is to be performed. - :type directory_path: str - :param change_detection_mode: Change Detection Mode. Applies to a directory specified in + :vartype directory_path: str + :ivar change_detection_mode: Change Detection Mode. Applies to a directory specified in directoryPath parameter. Possible values include: "Default", "Recursive". - :type change_detection_mode: str or ~azure.mgmt.storagesync.models.ChangeDetectionMode - :param paths: Array of relative paths on the Azure File share to be included in the change + :vartype change_detection_mode: str or ~azure.mgmt.storagesync.models.ChangeDetectionMode + :ivar paths: Array of relative paths on the Azure File share to be included in the change detection. Can be files and directories. - :type paths: list[str] + :vartype paths: list[str] """ _attribute_map = { @@ -2815,6 +3714,17 @@ def __init__( paths: Optional[List[str]] = None, **kwargs ): + """ + :keyword directory_path: Relative path to a directory Azure File share for which change + detection is to be performed. + :paramtype directory_path: str + :keyword change_detection_mode: Change Detection Mode. Applies to a directory specified in + directoryPath parameter. Possible values include: "Default", "Recursive". + :paramtype change_detection_mode: str or ~azure.mgmt.storagesync.models.ChangeDetectionMode + :keyword paths: Array of relative paths on the Azure File share to be included in the change + detection. Can be files and directories. + :paramtype paths: list[str] + """ super(TriggerChangeDetectionParameters, self).__init__(**kwargs) self.directory_path = directory_path self.change_detection_mode = change_detection_mode @@ -2824,8 +3734,8 @@ def __init__( class TriggerRolloverRequest(msrest.serialization.Model): """Trigger Rollover Request. - :param server_certificate: Certificate Data. - :type server_certificate: str + :ivar server_certificate: Certificate Data. + :vartype server_certificate: str """ _attribute_map = { @@ -2838,6 +3748,10 @@ def __init__( server_certificate: Optional[str] = None, **kwargs ): + """ + :keyword server_certificate: Certificate Data. + :paramtype server_certificate: str + """ super(TriggerRolloverRequest, self).__init__(**kwargs) self.server_certificate = server_certificate @@ -2855,6 +3769,9 @@ class Workflow(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData :ivar last_step_name: last step name. :vartype last_step_name: str :ivar status: workflow status. Possible values include: "active", "expired", "succeeded", @@ -2878,11 +3795,7 @@ class Workflow(ProxyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'last_step_name': {'readonly': True}, - 'status': {'readonly': True}, - 'operation': {'readonly': True}, - 'steps': {'readonly': True}, - 'last_operation_id': {'readonly': True}, + 'system_data': {'readonly': True}, 'command_name': {'readonly': True}, 'created_timestamp': {'readonly': True}, 'last_status_timestamp': {'readonly': True}, @@ -2892,6 +3805,7 @@ class Workflow(ProxyResource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'last_step_name': {'key': 'properties.lastStepName', 'type': 'str'}, 'status': {'key': 'properties.status', 'type': 'str'}, 'operation': {'key': 'properties.operation', 'type': 'str'}, @@ -2904,14 +3818,33 @@ class Workflow(ProxyResource): def __init__( self, - **kwargs - ): + *, + last_step_name: Optional[str] = None, + status: Optional[Union[str, "WorkflowStatus"]] = None, + operation: Optional[Union[str, "OperationDirection"]] = None, + steps: Optional[str] = None, + last_operation_id: Optional[str] = None, + **kwargs + ): + """ + :keyword last_step_name: last step name. + :paramtype last_step_name: str + :keyword status: workflow status. Possible values include: "active", "expired", "succeeded", + "aborted", "failed". + :paramtype status: str or ~azure.mgmt.storagesync.models.WorkflowStatus + :keyword operation: operation direction. Possible values include: "do", "undo", "cancel". + :paramtype operation: str or ~azure.mgmt.storagesync.models.OperationDirection + :keyword steps: workflow steps. + :paramtype steps: str + :keyword last_operation_id: workflow last operation identifier. + :paramtype last_operation_id: str + """ super(Workflow, self).__init__(**kwargs) - self.last_step_name = None - self.status = None - self.operation = None - self.steps = None - self.last_operation_id = None + self.last_step_name = last_step_name + self.status = status + self.operation = operation + self.steps = steps + self.last_operation_id = last_operation_id self.command_name = None self.created_timestamp = None self.last_status_timestamp = None @@ -2920,8 +3853,8 @@ def __init__( class WorkflowArray(msrest.serialization.Model): """Array of Workflow. - :param value: Collection of workflow items. - :type value: list[~azure.mgmt.storagesync.models.Workflow] + :ivar value: Collection of workflow items. + :vartype value: list[~azure.mgmt.storagesync.models.Workflow] """ _attribute_map = { @@ -2934,5 +3867,9 @@ def __init__( value: Optional[List["Workflow"]] = None, **kwargs ): + """ + :keyword value: Collection of workflow items. + :paramtype value: list[~azure.mgmt.storagesync.models.Workflow] + """ super(WorkflowArray, self).__init__(**kwargs) self.value = value diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/__init__.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/__init__.py index 85ce9379c268..6498106a813e 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/__init__.py @@ -16,6 +16,7 @@ from ._registered_servers_operations import RegisteredServersOperations from ._workflows_operations import WorkflowsOperations from ._operation_status_operations import OperationStatusOperations +from ._microsoft_storage_sync_operations import MicrosoftStorageSyncOperationsMixin __all__ = [ 'Operations', @@ -28,4 +29,5 @@ 'RegisteredServersOperations', 'WorkflowsOperations', 'OperationStatusOperations', + 'MicrosoftStorageSyncOperationsMixin', ] diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_cloud_endpoints_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_cloud_endpoints_operations.py index 73ad716cfc57..2dcf601e90b9 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_cloud_endpoints_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_cloud_endpoints_operations.py @@ -5,25 +5,470 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, 'str'), + "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, 'str'), + "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, 'str'), + "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_sync_group_request( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_pre_backup_request_initial( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prebackup') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, 'str'), + "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_post_backup_request_initial( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postbackup') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, 'str'), + "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_pre_restore_request_initial( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prerestore') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, 'str'), + "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_restoreheartbeat_request( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/restoreheartbeat') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, 'str'), + "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_post_restore_request_initial( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postrestore') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, 'str'), + "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_trigger_change_detection_request_initial( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/triggerChangeDetection') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, 'str'), + "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class CloudEndpointsOperations(object): """CloudEndpointsOperations operations. @@ -49,60 +494,49 @@ def __init__(self, client, config, serializer, deserializer): def _create_initial( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - cloud_endpoint_name, # type: str - parameters, # type: "_models.CloudEndpointCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.CloudEndpoint"] + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "_models.CloudEndpointCreateParameters", + **kwargs: Any + ) -> Optional["_models.CloudEndpoint"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CloudEndpoint"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'CloudEndpointCreateParameters') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CloudEndpointCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('CloudEndpoint', pipeline_response) if response.status_code == 202: @@ -111,23 +545,26 @@ def _create_initial( response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - cloud_endpoint_name, # type: str - parameters, # type: "_models.CloudEndpointCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CloudEndpoint"] + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "_models.CloudEndpointCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.CloudEndpoint"]: """Create a new CloudEndpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -142,15 +579,19 @@ def begin_create( :type parameters: ~azure.mgmt.storagesync.models.CloudEndpointCreateParameters :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CloudEndpoint or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CloudEndpoint or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.CloudEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -164,33 +605,25 @@ def begin_create( sync_group_name=sync_group_name, cloud_endpoint_name=cloud_endpoint_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('CloudEndpoint', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -202,17 +635,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - cloud_endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CloudEndpoint" + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> "_models.CloudEndpoint": """Get a given CloudEndpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -233,97 +667,79 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('CloudEndpoint', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - cloud_endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if response.status_code == 202: response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) @@ -331,21 +747,23 @@ def _delete_initial( response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - cloud_endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a given CloudEndpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -358,15 +776,17 @@ def begin_delete( :type cloud_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -382,23 +802,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -410,16 +821,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} # type: ignore + @distributed_trace def list_by_sync_group( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CloudEndpointArray"] + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs: Any + ) -> Iterable["_models.CloudEndpointArray"]: """Get a CloudEndpoint List. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -438,37 +850,35 @@ def list_by_sync_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_sync_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_sync_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + template_url=self.list_by_sync_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_sync_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CloudEndpointArray', pipeline_response) + deserialized = self._deserialize("CloudEndpointArray", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -481,12 +891,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -494,81 +905,72 @@ def get_next(next_link=None): def _pre_backup_initial( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - cloud_endpoint_name, # type: str - parameters, # type: "_models.BackupRequest" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "_models.BackupRequest", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._pre_backup_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BackupRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_pre_backup_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._pre_backup_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BackupRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _pre_backup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prebackup'} # type: ignore + + @distributed_trace def begin_pre_backup( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - cloud_endpoint_name, # type: str - parameters, # type: "_models.BackupRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "_models.BackupRequest", + **kwargs: Any + ) -> LROPoller[None]: """Pre Backup a given CloudEndpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -583,15 +985,18 @@ def begin_pre_backup( :type parameters: ~azure.mgmt.storagesync.models.BackupRequest :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -605,26 +1010,18 @@ def begin_pre_backup( sync_group_name=sync_group_name, cloud_endpoint_name=cloud_endpoint_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -636,88 +1033,81 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_pre_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prebackup'} # type: ignore def _post_backup_initial( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - cloud_endpoint_name, # type: str - parameters, # type: "_models.BackupRequest" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.PostBackupResponse"] + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "_models.BackupRequest", + **kwargs: Any + ) -> Optional["_models.PostBackupResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PostBackupResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._post_backup_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BackupRequest') + + request = build_post_backup_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._post_backup_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BackupRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('PostBackupResponse', pipeline_response) if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _post_backup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postbackup'} # type: ignore + + @distributed_trace def begin_post_backup( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - cloud_endpoint_name, # type: str - parameters, # type: "_models.BackupRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PostBackupResponse"] + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "_models.BackupRequest", + **kwargs: Any + ) -> LROPoller["_models.PostBackupResponse"]: """Post Backup a given CloudEndpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -732,15 +1122,19 @@ def begin_post_backup( :type parameters: ~azure.mgmt.storagesync.models.BackupRequest :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PostBackupResponse or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PostBackupResponse or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.PostBackupResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PostBackupResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -754,12 +1148,11 @@ def begin_post_backup( sync_group_name=sync_group_name, cloud_endpoint_name=cloud_endpoint_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} @@ -767,21 +1160,14 @@ def get_long_running_output(pipeline_response): response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('PostBackupResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -793,80 +1179,71 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postbackup'} # type: ignore def _pre_restore_initial( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - cloud_endpoint_name, # type: str - parameters, # type: "_models.PreRestoreRequest" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "_models.PreRestoreRequest", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._pre_restore_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PreRestoreRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_pre_restore_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._pre_restore_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PreRestoreRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _pre_restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prerestore'} # type: ignore + + @distributed_trace def begin_pre_restore( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - cloud_endpoint_name, # type: str - parameters, # type: "_models.PreRestoreRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "_models.PreRestoreRequest", + **kwargs: Any + ) -> LROPoller[None]: """Pre Restore a given CloudEndpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -881,15 +1258,18 @@ def begin_pre_restore( :type parameters: ~azure.mgmt.storagesync.models.PreRestoreRequest :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -903,26 +1283,18 @@ def begin_pre_restore( sync_group_name=sync_group_name, cloud_endpoint_name=cloud_endpoint_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -934,17 +1306,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_pre_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prerestore'} # type: ignore + @distributed_trace def restoreheartbeat( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - cloud_endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> None: """Restore Heartbeat a given CloudEndpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -965,118 +1338,100 @@ def restoreheartbeat( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.restoreheartbeat.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_restoreheartbeat_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + template_url=self.restoreheartbeat.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) restoreheartbeat.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/restoreheartbeat'} # type: ignore + def _post_restore_initial( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - cloud_endpoint_name, # type: str - parameters, # type: "_models.PostRestoreRequest" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "_models.PostRestoreRequest", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._post_restore_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'PostRestoreRequest') + + request = build_post_restore_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._post_restore_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PostRestoreRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _post_restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postrestore'} # type: ignore + + @distributed_trace def begin_post_restore( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - cloud_endpoint_name, # type: str - parameters, # type: "_models.PostRestoreRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "_models.PostRestoreRequest", + **kwargs: Any + ) -> LROPoller[None]: """Post Restore a given CloudEndpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1091,15 +1446,18 @@ def begin_post_restore( :type parameters: ~azure.mgmt.storagesync.models.PostRestoreRequest :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1113,26 +1471,18 @@ def begin_post_restore( sync_group_name=sync_group_name, cloud_endpoint_name=cloud_endpoint_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1144,80 +1494,71 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postrestore'} # type: ignore def _trigger_change_detection_initial( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - cloud_endpoint_name, # type: str - parameters, # type: "_models.TriggerChangeDetectionParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "_models.TriggerChangeDetectionParameters", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._trigger_change_detection_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'TriggerChangeDetectionParameters') + + request = build_trigger_change_detection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._trigger_change_detection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TriggerChangeDetectionParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _trigger_change_detection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/triggerChangeDetection'} # type: ignore + + @distributed_trace def begin_trigger_change_detection( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - cloud_endpoint_name, # type: str - parameters, # type: "_models.TriggerChangeDetectionParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "_models.TriggerChangeDetectionParameters", + **kwargs: Any + ) -> LROPoller[None]: """Triggers detection of changes performed on Azure File share connected to the specified Azure File Sync Cloud Endpoint. @@ -1233,15 +1574,18 @@ def begin_trigger_change_detection( :type parameters: ~azure.mgmt.storagesync.models.TriggerChangeDetectionParameters :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1255,26 +1599,18 @@ def begin_trigger_change_detection( sync_group_name=sync_group_name, cloud_endpoint_name=cloud_endpoint_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1286,4 +1622,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_trigger_change_detection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/triggerChangeDetection'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_microsoft_storage_sync_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_microsoft_storage_sync_operations.py new file mode 100644 index 000000000000..63045272bd08 --- /dev/null +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_microsoft_storage_sync_operations.py @@ -0,0 +1,118 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_location_operation_status_request( + subscription_id: str, + location_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/operations/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "locationName": _SERIALIZER.url("location_name", location_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class MicrosoftStorageSyncOperationsMixin(object): + + @distributed_trace + def location_operation_status( + self, + location_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.LocationOperationStatus": + """Get Operation status. + + :param location_name: The desired region to obtain information from. + :type location_name: str + :param operation_id: operation Id. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LocationOperationStatus, or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.LocationOperationStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocationOperationStatus"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_location_operation_status_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + operation_id=operation_id, + template_url=self.location_operation_status.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + deserialized = self._deserialize('LocationOperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + location_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/operations/{operationId}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_operation_status_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_operation_status_operations.py index 9570efb48cc9..f596a4cd4681 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_operation_status_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_operation_status_operations.py @@ -5,22 +5,63 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + location_name: str, + workflow_id: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/locations/{locationName}/workflows/{workflowId}/operations/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "locationName": _SERIALIZER.url("location_name", location_name, 'str'), + "workflowId": _SERIALIZER.url("workflow_id", workflow_id, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OperationStatusOperations(object): """OperationStatusOperations operations. @@ -44,15 +85,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - location_name, # type: str - workflow_id, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationStatus" + resource_group_name: str, + location_name: str, + workflow_id: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationStatus": """Get Operation status. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -73,44 +114,37 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'workflowId': self._serialize.url("workflow_id", workflow_id, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + location_name=location_name, + workflow_id=workflow_id, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('OperationStatus', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/locations/{locationName}/workflows/{workflowId}/operations/{operationId}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_operations.py index 56933c8f386d..8f5f08e6980d 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.StorageSync/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,15 +72,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationEntityListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationEntityListResult"]: """Lists all of the available Storage Sync Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationEntityListResult or the result of cls(response) + :return: An iterator like instance of either OperationEntityListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.OperationEntityListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationEntityListResult', pipeline_response) + deserialized = self._deserialize("OperationEntityListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,12 +123,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_private_endpoint_connections_operations.py index 8c5c63c59860..ad698b9cbe3b 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_private_endpoint_connections_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + resource_group_name: str, + storage_sync_service_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name: str, + storage_sync_service_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + storage_sync_service_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_storage_sync_service_request( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -47,14 +205,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Gets the specified private endpoint connection associated with the storage sync service. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -75,34 +233,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -111,59 +259,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - private_endpoint_connection_name, # type: str - properties, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.PrivateEndpointConnection"] + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> Optional["_models.PrivateEndpointConnection"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -173,22 +311,25 @@ def _create_initial( response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - private_endpoint_connection_name, # type: str - properties, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: """Update the state of specified private endpoint connection associated with the storage sync service. @@ -204,15 +345,19 @@ def begin_create( :type properties: ~azure.mgmt.storagesync.models.PrivateEndpointConnection :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -225,28 +370,21 @@ def begin_create( storage_sync_service_name=storage_sync_service_name, private_endpoint_connection_name=private_endpoint_connection_name, properties=properties, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -258,50 +396,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: @@ -310,20 +437,22 @@ def _delete_initial( response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified private endpoint connection associated with the storage sync service. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -336,15 +465,17 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -359,22 +490,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -386,15 +509,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list_by_storage_sync_service( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: """Get a PrivateEndpointConnection List. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -402,8 +526,10 @@ def list_by_storage_sync_service( :param storage_sync_service_name: Name of Storage Sync Service resource. :type storage_sync_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -411,36 +537,33 @@ def list_by_storage_sync_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_storage_sync_service.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_sync_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + template_url=self.list_by_storage_sync_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_sync_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -453,12 +576,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_private_link_resources_operations.py index 28a2bdf10300..ef1fb724711e 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_private_link_resources_operations.py @@ -5,22 +5,59 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_storage_sync_service_request( + resource_group_name: str, + storage_sync_service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateLinkResources') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -44,13 +81,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_sync_service( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceListResult" + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources that need to be created for a storage sync service. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -68,27 +105,17 @@ def list_by_storage_sync_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.list_by_storage_sync_service.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_storage_sync_service_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_storage_sync_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,4 +129,6 @@ def list_by_storage_sync_service( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateLinkResources'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_registered_servers_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_registered_servers_operations.py index 8d6904097453..1188407260da 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_registered_servers_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_registered_servers_operations.py @@ -5,25 +5,229 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_storage_sync_service_request( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "serverId": _SERIALIZER.url("server_id", server_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "serverId": _SERIALIZER.url("server_id", server_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "serverId": _SERIALIZER.url("server_id", server_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_trigger_rollover_request_initial( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}/triggerRollover') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "serverId": _SERIALIZER.url("server_id", server_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class RegisteredServersOperations(object): """RegisteredServersOperations operations. @@ -47,13 +251,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_sync_service( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RegisteredServerArray"] + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> Iterable["_models.RegisteredServerArray"]: """Get a given registered server list. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -61,7 +265,8 @@ def list_by_storage_sync_service( :param storage_sync_service_name: Name of Storage Sync Service resource. :type storage_sync_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RegisteredServerArray or the result of cls(response) + :return: An iterator like instance of either RegisteredServerArray or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.RegisteredServerArray] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,36 +275,33 @@ def list_by_storage_sync_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_storage_sync_service.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_sync_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + template_url=self.list_by_storage_sync_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_sync_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RegisteredServerArray', pipeline_response) + deserialized = self._deserialize("RegisteredServerArray", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,25 +314,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - server_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RegisteredServer" + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + **kwargs: Any + ) -> "_models.RegisteredServer": """Get a given registered server. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -149,101 +352,83 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('RegisteredServer', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - server_id, # type: str - parameters, # type: "_models.RegisteredServerCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RegisteredServer"] + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: "_models.RegisteredServerCreateParameters", + **kwargs: Any + ) -> Optional["_models.RegisteredServer"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RegisteredServer"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RegisteredServerCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RegisteredServerCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('RegisteredServer', pipeline_response) if response.status_code == 202: @@ -251,22 +436,25 @@ def _create_initial( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - server_id, # type: str - parameters, # type: "_models.RegisteredServerCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RegisteredServer"] + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: "_models.RegisteredServerCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.RegisteredServer"]: """Add a new registered server. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -279,15 +467,19 @@ def begin_create( :type parameters: ~azure.mgmt.storagesync.models.RegisteredServerCreateParameters :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RegisteredServer or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RegisteredServer or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.RegisteredServer] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RegisteredServer"] lro_delay = kwargs.pop( 'polling_interval', @@ -300,32 +492,25 @@ def begin_create( storage_sync_service_name=storage_sync_service_name, server_id=server_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('RegisteredServer', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -337,74 +522,66 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - server_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - server_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the given registered server. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -415,15 +592,17 @@ def begin_delete( :type server_id: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -438,22 +617,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -465,81 +636,73 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} # type: ignore def _trigger_rollover_initial( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - server_id, # type: str - parameters, # type: "_models.TriggerRolloverRequest" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: "_models.TriggerRolloverRequest", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._trigger_rollover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'TriggerRolloverRequest') + + request = build_trigger_rollover_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + content_type=content_type, + json=_json, + template_url=self._trigger_rollover_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TriggerRolloverRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _trigger_rollover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}/triggerRollover'} # type: ignore + + @distributed_trace def begin_trigger_rollover( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - server_id, # type: str - parameters, # type: "_models.TriggerRolloverRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: "_models.TriggerRolloverRequest", + **kwargs: Any + ) -> LROPoller[None]: """Triggers Server certificate rollover. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -552,15 +715,18 @@ def begin_trigger_rollover( :type parameters: ~azure.mgmt.storagesync.models.TriggerRolloverRequest :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -573,25 +739,18 @@ def begin_trigger_rollover( storage_sync_service_name=storage_sync_service_name, server_id=server_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -603,4 +762,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_trigger_rollover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}/triggerRollover'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_server_endpoints_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_server_endpoints_operations.py index 32cd79267ddb..db73353a8cd4 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_server_endpoints_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_server_endpoints_operations.py @@ -5,25 +5,287 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, 'str'), + "serverEndpointName": _SERIALIZER.url("server_endpoint_name", server_endpoint_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, 'str'), + "serverEndpointName": _SERIALIZER.url("server_endpoint_name", server_endpoint_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, 'str'), + "serverEndpointName": _SERIALIZER.url("server_endpoint_name", server_endpoint_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, 'str'), + "serverEndpointName": _SERIALIZER.url("server_endpoint_name", server_endpoint_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_sync_group_request( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_recall_action_request_initial( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}/recallAction') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, 'str'), + "serverEndpointName": _SERIALIZER.url("server_endpoint_name", server_endpoint_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class ServerEndpointsOperations(object): """ServerEndpointsOperations operations. @@ -49,60 +311,49 @@ def __init__(self, client, config, serializer, deserializer): def _create_initial( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - server_endpoint_name, # type: str - parameters, # type: "_models.ServerEndpointCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ServerEndpoint"] + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: "_models.ServerEndpointCreateParameters", + **kwargs: Any + ) -> Optional["_models.ServerEndpoint"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ServerEndpoint"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ServerEndpointCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServerEndpointCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('ServerEndpoint', pipeline_response) if response.status_code == 202: @@ -110,23 +361,26 @@ def _create_initial( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - server_endpoint_name, # type: str - parameters, # type: "_models.ServerEndpointCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServerEndpoint"] + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: "_models.ServerEndpointCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.ServerEndpoint"]: """Create a new ServerEndpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -141,15 +395,19 @@ def begin_create( :type parameters: ~azure.mgmt.storagesync.models.ServerEndpointCreateParameters :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServerEndpoint or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServerEndpoint or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -163,33 +421,25 @@ def begin_create( sync_group_name=sync_group_name, server_endpoint_name=server_endpoint_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('ServerEndpoint', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -201,67 +451,57 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - server_endpoint_name, # type: str - parameters=None, # type: Optional["_models.ServerEndpointUpdateParameters"] - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ServerEndpoint"] + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Optional["_models.ServerEndpointUpdateParameters"] = None, + **kwargs: Any + ) -> Optional["_models.ServerEndpoint"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ServerEndpoint"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ServerEndpointUpdateParameters') + _json = self._serialize.body(parameters, 'ServerEndpointUpdateParameters') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('ServerEndpoint', pipeline_response) if response.status_code == 202: @@ -269,23 +509,26 @@ def _update_initial( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - server_endpoint_name, # type: str - parameters=None, # type: Optional["_models.ServerEndpointUpdateParameters"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServerEndpoint"] + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Optional["_models.ServerEndpointUpdateParameters"] = None, + **kwargs: Any + ) -> LROPoller["_models.ServerEndpoint"]: """Patch a given ServerEndpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -300,15 +543,19 @@ def begin_update( :type parameters: ~azure.mgmt.storagesync.models.ServerEndpointUpdateParameters :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServerEndpoint or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServerEndpoint or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -322,33 +569,25 @@ def begin_update( sync_group_name=sync_group_name, server_endpoint_name=server_endpoint_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('ServerEndpoint', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -360,17 +599,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - server_endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ServerEndpoint" + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + **kwargs: Any + ) -> "_models.ServerEndpoint": """Get a ServerEndpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -391,117 +631,101 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('ServerEndpoint', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - server_endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - server_endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a given ServerEndpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -514,15 +738,17 @@ def begin_delete( :type server_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -538,23 +764,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -566,16 +783,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} # type: ignore + @distributed_trace def list_by_sync_group( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServerEndpointArray"] + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ServerEndpointArray"]: """Get a ServerEndpoint list. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -594,37 +812,35 @@ def list_by_sync_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_sync_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_sync_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + template_url=self.list_by_sync_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_sync_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServerEndpointArray', pipeline_response) + deserialized = self._deserialize("ServerEndpointArray", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -637,12 +853,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -650,80 +867,71 @@ def get_next(next_link=None): def _recall_action_initial( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - server_endpoint_name, # type: str - parameters, # type: "_models.RecallActionParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: "_models.RecallActionParameters", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._recall_action_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RecallActionParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_recall_action_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._recall_action_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RecallActionParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _recall_action_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}/recallAction'} # type: ignore + + @distributed_trace def begin_recall_action( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - server_endpoint_name, # type: str - parameters, # type: "_models.RecallActionParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: "_models.RecallActionParameters", + **kwargs: Any + ) -> LROPoller[None]: """Recall a server endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -738,15 +946,18 @@ def begin_recall_action( :type parameters: ~azure.mgmt.storagesync.models.RecallActionParameters :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -760,26 +971,18 @@ def begin_recall_action( sync_group_name=sync_group_name, server_endpoint_name=server_endpoint_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -791,4 +994,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_recall_action.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}/recallAction'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_storage_sync_services_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_storage_sync_services_operations.py index fad2c652c330..3dda9e9b4b7d 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_storage_sync_services_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_storage_sync_services_operations.py @@ -5,25 +5,292 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_check_name_availability_request( + location_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability') + path_format_arguments = { + "locationName": _SERIALIZER.url("location_name", location_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/storageSyncServices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class StorageSyncServicesOperations(object): """StorageSyncServicesOperations operations. @@ -47,13 +314,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - location_name, # type: str - parameters, # type: "_models.CheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + location_name: str, + parameters: "_models.CheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Check the give namespace name availability. :param location_name: The desired region for the name check. @@ -70,31 +337,21 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_check_name_availability_request( + location_name=location_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') - 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 @@ -108,57 +365,47 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - parameters, # type: "_models.StorageSyncServiceCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageSyncService"] + resource_group_name: str, + storage_sync_service_name: str, + parameters: "_models.StorageSyncServiceCreateParameters", + **kwargs: Any + ) -> Optional["_models.StorageSyncService"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageSyncService"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageSyncServiceCreateParameters') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageSyncServiceCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('StorageSyncService', pipeline_response) @@ -168,21 +415,24 @@ def _create_initial( response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - parameters, # type: "_models.StorageSyncServiceCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageSyncService"] + resource_group_name: str, + storage_sync_service_name: str, + parameters: "_models.StorageSyncServiceCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.StorageSyncService"]: """Create a new StorageSyncService. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -193,15 +443,19 @@ def begin_create( :type parameters: ~azure.mgmt.storagesync.models.StorageSyncServiceCreateParameters :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either StorageSyncService or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageSyncService or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.StorageSyncService] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSyncService"] lro_delay = kwargs.pop( 'polling_interval', @@ -213,27 +467,21 @@ def begin_create( resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageSyncService', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -245,15 +493,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageSyncService" + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> "_models.StorageSyncService": """Get a given StorageSyncService. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -270,101 +519,83 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('StorageSyncService', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore + def _update_initial( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - parameters=None, # type: Optional["_models.StorageSyncServiceUpdateParameters"] - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageSyncService"] + resource_group_name: str, + storage_sync_service_name: str, + parameters: Optional["_models.StorageSyncServiceUpdateParameters"] = None, + **kwargs: Any + ) -> Optional["_models.StorageSyncService"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageSyncService"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'StorageSyncServiceUpdateParameters') + _json = self._serialize.body(parameters, 'StorageSyncServiceUpdateParameters') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('StorageSyncService', pipeline_response) if response.status_code == 202: @@ -373,21 +604,24 @@ def _update_initial( response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - parameters=None, # type: Optional["_models.StorageSyncServiceUpdateParameters"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageSyncService"] + resource_group_name: str, + storage_sync_service_name: str, + parameters: Optional["_models.StorageSyncServiceUpdateParameters"] = None, + **kwargs: Any + ) -> LROPoller["_models.StorageSyncService"]: """Patch a given StorageSyncService. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -398,15 +632,19 @@ def begin_update( :type parameters: ~azure.mgmt.storagesync.models.StorageSyncServiceUpdateParameters :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either StorageSyncService or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageSyncService or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.StorageSyncService] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSyncService"] lro_delay = kwargs.pop( 'polling_interval', @@ -418,31 +656,25 @@ def begin_update( resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('StorageSyncService', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -454,53 +686,43 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if response.status_code == 202: response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) @@ -508,19 +730,21 @@ def _delete_initial( response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a given StorageSyncService. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -529,15 +753,17 @@ def begin_delete( :type storage_sync_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -551,21 +777,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -577,20 +796,22 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageSyncServiceArray"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageSyncServiceArray"]: """Get a StorageSyncService list by Resource group name. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSyncServiceArray or the result of cls(response) + :return: An iterator like instance of either StorageSyncServiceArray or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.StorageSyncServiceArray] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -599,35 +820,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageSyncServiceArray', pipeline_response) + deserialized = self._deserialize("StorageSyncServiceArray", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -640,26 +857,28 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices'} # type: ignore + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageSyncServiceArray"] + **kwargs: Any + ) -> Iterable["_models.StorageSyncServiceArray"]: """Get a StorageSyncService list by subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSyncServiceArray or the result of cls(response) + :return: An iterator like instance of either StorageSyncServiceArray or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.StorageSyncServiceArray] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -668,34 +887,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageSyncServiceArray', pipeline_response) + deserialized = self._deserialize("StorageSyncServiceArray", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -708,12 +922,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_sync_groups_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_sync_groups_operations.py index 2747ab44058a..b0d2a588d87b 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_sync_groups_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_sync_groups_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_storage_sync_service_request( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SyncGroupsOperations(object): """SyncGroupsOperations operations. @@ -45,13 +203,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_sync_service( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SyncGroupArray"] + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> Iterable["_models.SyncGroupArray"]: """Get a SyncGroup List. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -68,36 +226,33 @@ def list_by_storage_sync_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_storage_sync_service.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_sync_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + template_url=self.list_by_storage_sync_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_sync_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SyncGroupArray', pipeline_response) + deserialized = self._deserialize("SyncGroupArray", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,26 +265,27 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups'} # type: ignore + @distributed_trace def create( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - parameters, # type: "_models.SyncGroupCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SyncGroup" + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + parameters: "_models.SyncGroupCreateParameters", + **kwargs: Any + ) -> "_models.SyncGroup": """Create a new SyncGroup. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -150,60 +306,53 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SyncGroupCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SyncGroupCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('SyncGroup', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SyncGroup" + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs: Any + ) -> "_models.SyncGroup": """Get a given SyncGroup. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -222,55 +371,48 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('SyncGroup', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - sync_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs: Any + ) -> None: """Delete a given SyncGroup. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -289,42 +431,34 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_workflows_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_workflows_operations.py index 0a90d5cbecc6..da6ff7db91fa 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_workflows_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_workflows_operations.py @@ -5,23 +5,134 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_storage_sync_service_request( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + workflow_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "workflowId": _SERIALIZER.url("workflow_id", workflow_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_abort_request( + subscription_id: str, + resource_group_name: str, + storage_sync_service_name: str, + workflow_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}/abort') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, 'str'), + "workflowId": _SERIALIZER.url("workflow_id", workflow_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WorkflowsOperations(object): """WorkflowsOperations operations. @@ -45,13 +156,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_sync_service( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WorkflowArray"] + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> Iterable["_models.WorkflowArray"]: """Get a Workflow List. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -68,36 +179,33 @@ def list_by_storage_sync_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_storage_sync_service.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_sync_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + template_url=self.list_by_storage_sync_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_sync_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WorkflowArray', pipeline_response) + deserialized = self._deserialize("WorkflowArray", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,25 +218,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - workflow_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Workflow" + resource_group_name: str, + storage_sync_service_name: str, + workflow_id: str, + **kwargs: Any + ) -> "_models.Workflow": """Get Workflows resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -147,55 +256,48 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'workflowId': self._serialize.url("workflow_id", workflow_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + workflow_id=workflow_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('Workflow', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}'} # type: ignore + + @distributed_trace def abort( self, - resource_group_name, # type: str - storage_sync_service_name, # type: str - workflow_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + storage_sync_service_name: str, + workflow_id: str, + **kwargs: Any + ) -> None: """Abort the given workflow. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -214,41 +316,33 @@ def abort( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.abort.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'workflowId': self._serialize.url("workflow_id", workflow_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_abort_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + workflow_id=workflow_id, + template_url=self.abort.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageSyncError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + if cls: return cls(pipeline_response, None, response_headers) abort.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}/abort'} # type: ignore +