diff --git a/sdk/storage/azure-mgmt-storagecache/_meta.json b/sdk/storage/azure-mgmt-storagecache/_meta.json index 412444d4809aa..f1e19c1ddc77d 100644 --- a/sdk/storage/azure-mgmt-storagecache/_meta.json +++ b/sdk/storage/azure-mgmt-storagecache/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "21ebd57c7bcf94b51f2d2b94f64ceb140201757b", + "commit": "2ab4371edba33c23e8d680ed2bf6f98705b5cadb", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/storagecache/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/storagecache/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.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/storagecache/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/__init__.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/__init__.py index 12859a199fab0..b265bac8758ec 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/__init__.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['StorageCacheManagementClient'] -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-storagecache/azure/mgmt/storagecache/_configuration.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_configuration.py index 60b77f200bef2..dd482580daf8d 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_configuration.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None + super(StorageCacheManagementClientConfiguration, 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(StorageCacheManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +68,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-storagecache/azure/mgmt/storagecache/_metadata.json b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_metadata.json index b92eae6592dd3..12b6f04cf2947 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_metadata.json +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_metadata.json @@ -5,13 +5,13 @@ "name": "StorageCacheManagementClient", "filename": "_storage_cache_management_client", "description": "A Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as \"Storage Targets\"). These operations allow you to manage Caches.", - "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\": [\"StorageCacheManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageCacheManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageCacheManagementClientConfiguration\"]}}, \"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\": [\"StorageCacheManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_patch.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_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-storagecache/azure/mgmt/storagecache/_storage_cache_management_client.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_storage_cache_management_client.py index 27e399f3e310a..672459865d1a9 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_storage_cache_management_client.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_storage_cache_management_client.py @@ -6,28 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import StorageCacheManagementClientConfiguration +from .operations import AscOperationsOperations, CachesOperations, Operations, SkusOperations, StorageTargetOperations, StorageTargetsOperations, UsageModelsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Optional from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import StorageCacheManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import UsageModelsOperations -from .operations import AscOperationsOperations -from .operations import CachesOperations -from .operations import StorageTargetsOperations -from .operations import StorageTargetOperations -from . import models - + from azure.core.rest import HttpRequest, HttpResponse class StorageCacheManagementClient(object): """A Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage Caches. @@ -48,62 +42,65 @@ class StorageCacheManagementClient(object): :vartype storage_target: storage_cache_management_client.operations.StorageTargetOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageCacheManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = StorageCacheManagementClientConfiguration(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.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage_models = UsageModelsOperations(self._client, self._config, self._serialize, self._deserialize) + self.asc_operations = AscOperationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.caches = CachesOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_targets = StorageTargetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_target = StorageTargetOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage_models = UsageModelsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.asc_operations = AscOperationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.caches = CachesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_targets = StorageTargetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_target = StorageTargetOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> HttpResponse """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_vendor.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_vendor.py new file mode 100644 index 0000000000000..138f663c53a4e --- /dev/null +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_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-storagecache/azure/mgmt/storagecache/_version.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_version.py index 59deb8c7263be..e5754a47ce68f 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_version.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/__init__.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/__init__.py index b1121365385a5..8acb2c057e6d6 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/__init__.py @@ -8,3 +8,8 @@ from ._storage_cache_management_client import StorageCacheManagementClient __all__ = ['StorageCacheManagementClient'] + +# `._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-storagecache/azure/mgmt/storagecache/aio/_configuration.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/_configuration.py index ca01ad876a4db..821fe6bbf1b9d 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/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(StorageCacheManagementClientConfiguration, 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(StorageCacheManagementClientConfiguration, 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-storagecache/azure/mgmt/storagecache/aio/_patch.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/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-storagecache/azure/mgmt/storagecache/aio/_storage_cache_management_client.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/_storage_cache_management_client.py index 5ecd23ba3ad72..e9efdff4dda8a 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/_storage_cache_management_client.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/_storage_cache_management_client.py @@ -6,28 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import StorageCacheManagementClientConfiguration +from .operations import AscOperationsOperations, CachesOperations, Operations, SkusOperations, StorageTargetOperations, StorageTargetsOperations, UsageModelsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import StorageCacheManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import UsageModelsOperations -from .operations import AscOperationsOperations -from .operations import CachesOperations -from .operations import StorageTargetsOperations -from .operations import StorageTargetOperations -from .. import models - - -class StorageCacheManagementClient(object): +class StorageCacheManagementClient: """A Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage Caches. :ivar operations: Operations operations @@ -41,65 +35,69 @@ class StorageCacheManagementClient(object): :ivar caches: CachesOperations operations :vartype caches: storage_cache_management_client.aio.operations.CachesOperations :ivar storage_targets: StorageTargetsOperations operations - :vartype storage_targets: storage_cache_management_client.aio.operations.StorageTargetsOperations + :vartype storage_targets: + storage_cache_management_client.aio.operations.StorageTargetsOperations :ivar storage_target: StorageTargetOperations operations :vartype storage_target: storage_cache_management_client.aio.operations.StorageTargetOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :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 = StorageCacheManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = StorageCacheManagementClientConfiguration(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.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage_models = UsageModelsOperations(self._client, self._config, self._serialize, self._deserialize) + self.asc_operations = AscOperationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.caches = CachesOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_targets = StorageTargetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_target = StorageTargetOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage_models = UsageModelsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.asc_operations = AscOperationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.caches = CachesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_targets = StorageTargetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_target = StorageTargetOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_asc_operations_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_asc_operations_operations.py index b92ff67d68ab1..9fc1105af4e7e 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_asc_operations_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_asc_operations_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._asc_operations_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -62,27 +67,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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'), - 'location': self._serialize.url("location", location, '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, + location=location, + 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 @@ -96,4 +91,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/ascOperations/{operationId}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_caches_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_caches_operations.py index a766d890303ca..7798f541f891e 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_caches_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_caches_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._caches_operations import build_create_or_update_request_initial, build_debug_info_request_initial, build_delete_request_initial, build_flush_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_start_request_initial, build_stop_request_initial, build_update_request, build_upgrade_firmware_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -51,7 +57,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CachesListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~storage_cache_management_client.models.CachesListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~storage_cache_management_client.models.CachesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CachesListResult"] @@ -59,34 +66,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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 - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + 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('CachesListResult', pipeline_response) + deserialized = self._deserialize("CachesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -104,11 +106,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -120,7 +124,8 @@ def list_by_resource_group( :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 CachesListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~storage_cache_management_client.models.CachesListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~storage_cache_management_client.models.CachesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CachesListResult"] @@ -128,35 +133,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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( + resource_group_name=resource_group_name, + 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('CachesListResult', pipeline_response) + deserialized = self._deserialize("CachesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -174,6 +175,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -190,27 +192,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # 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, + cache_name=cache_name, + subscription_id=self._config.subscription_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 @@ -223,6 +215,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -238,15 +232,17 @@ async def begin_delete( :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -260,21 +256,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'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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: @@ -286,8 +275,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -311,27 +302,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # 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, + cache_name=cache_name, + subscription_id=self._config.subscription_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 @@ -345,8 +326,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -359,35 +342,25 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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') - - body_content_kwargs = {} # type: Dict[str, Any] if cache is not None: - body_content = self._serialize.body(cache, 'Cache') + _json = self._serialize.body(cache, 'Cache') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -406,8 +379,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -427,15 +403,18 @@ async def begin_create_or_update( :type cache: ~storage_cache_management_client.models.Cache :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Cache or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~storage_cache_management_client.models.Cache] - :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.Cache"] lro_delay = kwargs.pop( 'polling_interval', @@ -447,27 +426,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, cache_name=cache_name, cache=cache, + 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('Cache', 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - 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: @@ -479,8 +452,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + @distributed_trace_async async def update( self, resource_group_name: str, @@ -508,35 +483,25 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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') - - body_content_kwargs = {} # type: Dict[str, Any] if cache is not None: - body_content = self._serialize.body(cache, 'Cache') + _json = self._serialize.body(cache, 'Cache') 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + content_type=content_type, + json=_json, + template_url=self.update.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 @@ -550,8 +515,10 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + async def _debug_info_initial( self, resource_group_name: str, @@ -563,27 +530,17 @@ async def _debug_info_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._debug_info_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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_debug_info_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + template_url=self._debug_info_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -596,6 +553,8 @@ async def _debug_info_initial( _debug_info_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo'} # type: ignore + + @distributed_trace_async async def begin_debug_info( self, resource_group_name: str, @@ -611,15 +570,17 @@ async def begin_debug_info( :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -633,21 +594,14 @@ async def begin_debug_info( 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -659,6 +613,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_debug_info.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo'} # type: ignore async def _flush_initial( @@ -672,27 +627,17 @@ async def _flush_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._flush_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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_flush_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + template_url=self._flush_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -705,6 +650,8 @@ async def _flush_initial( _flush_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush'} # type: ignore + + @distributed_trace_async async def begin_flush( self, resource_group_name: str, @@ -721,15 +668,17 @@ async def begin_flush( :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -743,21 +692,14 @@ async def begin_flush( 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -769,6 +711,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_flush.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush'} # type: ignore async def _start_initial( @@ -782,27 +725,17 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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_start_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -815,6 +748,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -830,15 +765,17 @@ async def begin_start( :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -852,21 +789,14 @@ async def begin_start( 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -878,6 +808,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start'} # type: ignore async def _stop_initial( @@ -891,27 +822,17 @@ async def _stop_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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_stop_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -924,6 +845,8 @@ async def _stop_initial( _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop'} # type: ignore + + @distributed_trace_async async def begin_stop( self, resource_group_name: str, @@ -939,15 +862,17 @@ async def begin_stop( :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -961,21 +886,14 @@ async def begin_stop( 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -987,6 +905,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop'} # type: ignore async def _upgrade_firmware_initial( @@ -1000,27 +919,17 @@ async def _upgrade_firmware_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._upgrade_firmware_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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_upgrade_firmware_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + template_url=self._upgrade_firmware_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1033,6 +942,8 @@ async def _upgrade_firmware_initial( _upgrade_firmware_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade'} # type: ignore + + @distributed_trace_async async def begin_upgrade_firmware( self, resource_group_name: str, @@ -1049,15 +960,17 @@ async def begin_upgrade_firmware( :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1071,21 +984,14 @@ async def begin_upgrade_firmware( 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1097,4 +1003,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_upgrade_firmware.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_operations.py index ae89eb1912399..bc85dfb0c674c 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Lists all of the available Resource Provider operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiOperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~storage_cache_management_client.models.ApiOperationListResult] + :return: An iterator like instance of either ApiOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~storage_cache_management_client.models.ApiOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiOperationListResult"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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('ApiOperationListResult', pipeline_response) + deserialized = self._deserialize("ApiOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +103,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_skus_operations.py index 52504304edf96..31f0d09282ec0 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_skus_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._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceSkusResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~storage_cache_management_client.models.ResourceSkusResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~storage_cache_management_client.models.ResourceSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkusResult"] @@ -57,34 +64,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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 - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + 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('ResourceSkusResult', pipeline_response) + deserialized = self._deserialize("ResourceSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +104,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_target_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_target_operations.py index 09cb276b9ba88..5919a76ea17a4 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_target_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_target_operations.py @@ -5,18 +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, Callable, Dict, Generic, Optional, TypeVar, Union 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +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_target_operations import build_flush_request_initial, build_resume_request_initial, build_suspend_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,28 +58,18 @@ async def _flush_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._flush_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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_flush_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + storage_target_name=storage_target_name, + template_url=self._flush_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -88,6 +82,8 @@ async def _flush_initial( _flush_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/flush'} # type: ignore + + @distributed_trace_async async def begin_flush( self, resource_group_name: str, @@ -108,15 +104,17 @@ async def begin_flush( :type storage_target_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -131,22 +129,14 @@ async def begin_flush( 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -158,6 +148,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_flush.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/flush'} # type: ignore async def _suspend_initial( @@ -172,28 +163,18 @@ async def _suspend_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._suspend_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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_suspend_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + storage_target_name=storage_target_name, + template_url=self._suspend_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -206,6 +187,8 @@ async def _suspend_initial( _suspend_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/suspend'} # type: ignore + + @distributed_trace_async async def begin_suspend( self, resource_group_name: str, @@ -224,15 +207,17 @@ async def begin_suspend( :type storage_target_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -247,22 +232,14 @@ async def begin_suspend( 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -274,6 +251,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_suspend.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/suspend'} # type: ignore async def _resume_initial( @@ -288,28 +266,18 @@ async def _resume_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._resume_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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_resume_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + storage_target_name=storage_target_name, + template_url=self._resume_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -322,6 +290,8 @@ async def _resume_initial( _resume_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/resume'} # type: ignore + + @distributed_trace_async async def begin_resume( self, resource_group_name: str, @@ -340,15 +310,17 @@ async def begin_resume( :type storage_target_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -363,22 +335,14 @@ async def begin_resume( 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -390,4 +354,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_resume.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/resume'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_targets_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_targets_operations.py index 69294603a06db..cd67d08304a2a 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_targets_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_targets_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_targets_operations import build_create_or_update_request_initial, build_delete_request_initial, build_dns_refresh_request_initial, build_get_request, build_list_by_cache_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,28 +60,18 @@ async def _dns_refresh_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._dns_refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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_dns_refresh_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + storage_target_name=storage_target_name, + template_url=self._dns_refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,6 +84,8 @@ async def _dns_refresh_initial( _dns_refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh'} # type: ignore + + @distributed_trace_async async def begin_dns_refresh( self, resource_group_name: str, @@ -107,15 +104,17 @@ async def begin_dns_refresh( :type storage_target_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -130,22 +129,14 @@ async def begin_dns_refresh( 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -157,8 +148,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_dns_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh'} # type: ignore + @distributed_trace def list_by_cache( self, resource_group_name: str, @@ -173,8 +166,10 @@ def list_by_cache( from the [-0-9a-zA-Z_] char class. :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageTargetsResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~storage_cache_management_client.models.StorageTargetsResult] + :return: An iterator like instance of either StorageTargetsResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~storage_cache_management_client.models.StorageTargetsResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageTargetsResult"] @@ -182,36 +177,33 @@ def list_by_cache( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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_cache.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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_cache_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + template_url=self.list_by_cache.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_cache_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_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('StorageTargetsResult', pipeline_response) + deserialized = self._deserialize("StorageTargetsResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -229,6 +221,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -247,30 +240,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force is not None: - query_parameters['force'] = self._serialize.query("force", force, '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, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + storage_target_name=storage_target_name, + force=force, + 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 @@ -283,6 +265,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -308,15 +292,17 @@ async def begin_delete( :type force: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -332,22 +318,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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - 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: @@ -359,8 +337,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -387,28 +367,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + storage_target_name=storage_target_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 @@ -422,8 +392,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -437,36 +409,26 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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') - - body_content_kwargs = {} # type: Dict[str, Any] if storagetarget is not None: - body_content = self._serialize.body(storagetarget, 'StorageTarget') + _json = self._serialize.body(storagetarget, 'StorageTarget') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + storage_target_name=storage_target_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -485,8 +447,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -510,15 +475,20 @@ async def begin_create_or_update( :type storagetarget: ~storage_cache_management_client.models.StorageTarget :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageTarget or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~storage_cache_management_client.models.StorageTarget] - :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 StorageTarget or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~storage_cache_management_client.models.StorageTarget] + :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.StorageTarget"] lro_delay = kwargs.pop( 'polling_interval', @@ -531,28 +501,21 @@ async def begin_create_or_update( cache_name=cache_name, storage_target_name=storage_target_name, storagetarget=storagetarget, + 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('StorageTarget', 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - 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: @@ -564,4 +527,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_usage_models_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_usage_models_operations.py index f911ccab46604..1f3147c22440e 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_usage_models_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_usage_models_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._usage_models_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageModelsResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~storage_cache_management_client.models.UsageModelsResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~storage_cache_management_client.models.UsageModelsResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageModelsResult"] @@ -57,34 +64,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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 - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + 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('UsageModelsResult', pipeline_response) + deserialized = self._deserialize("UsageModelsResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +104,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/models/_models.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/models/_models.py index 2b21dd305e289..57474276e5e3e 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/models/_models.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/models/_models.py @@ -12,17 +12,16 @@ class ApiOperation(msrest.serialization.Model): """REST API operation description: see https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/openapi-authoring-automated-guidelines.md#r3023-operationsapiimplementation. - :param display: The object that represents the operation. - :type display: ~storage_cache_management_client.models.ApiOperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param is_data_action: The flag that indicates whether the operation applies to data plane. - :type is_data_action: bool - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param service_specification: Specification of the all the metrics provided for a resource - type. - :type service_specification: + :ivar display: The object that represents the operation. + :vartype display: ~storage_cache_management_client.models.ApiOperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar is_data_action: The flag that indicates whether the operation applies to data plane. + :vartype is_data_action: bool + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar service_specification: Specification of the all the metrics provided for a resource type. + :vartype service_specification: ~storage_cache_management_client.models.ApiOperationPropertiesServiceSpecification """ @@ -38,6 +37,20 @@ def __init__( self, **kwargs ): + """ + :keyword display: The object that represents the operation. + :paramtype display: ~storage_cache_management_client.models.ApiOperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword is_data_action: The flag that indicates whether the operation applies to data plane. + :paramtype is_data_action: bool + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword service_specification: Specification of the all the metrics provided for a resource + type. + :paramtype service_specification: + ~storage_cache_management_client.models.ApiOperationPropertiesServiceSpecification + """ super(ApiOperation, self).__init__(**kwargs) self.display = kwargs.get('display', None) self.origin = kwargs.get('origin', None) @@ -49,14 +62,14 @@ def __init__( class ApiOperationDisplay(msrest.serialization.Model): """The object that represents the operation. - :param operation: Operation type: Read, write, delete, etc. - :type operation: str - :param provider: Service provider: Microsoft.StorageCache. - :type provider: str - :param resource: Resource on which the operation is performed: Cache, etc. - :type resource: str - :param description: The description of the operation. - :type description: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + :ivar provider: Service provider: Microsoft.StorageCache. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Cache, etc. + :vartype resource: str + :ivar description: The description of the operation. + :vartype description: str """ _attribute_map = { @@ -70,6 +83,16 @@ def __init__( self, **kwargs ): + """ + :keyword operation: Operation type: Read, write, delete, etc. + :paramtype operation: str + :keyword provider: Service provider: Microsoft.StorageCache. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed: Cache, etc. + :paramtype resource: str + :keyword description: The description of the operation. + :paramtype description: str + """ super(ApiOperationDisplay, self).__init__(**kwargs) self.operation = kwargs.get('operation', None) self.provider = kwargs.get('provider', None) @@ -80,11 +103,11 @@ def __init__( class ApiOperationListResult(msrest.serialization.Model): """Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get the next set of results. - :param next_link: URL to get the next set of operation list results if there are any. - :type next_link: str - :param value: List of Resource Provider operations supported by the Microsoft.StorageCache + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + :ivar value: List of Resource Provider operations supported by the Microsoft.StorageCache resource provider. - :type value: list[~storage_cache_management_client.models.ApiOperation] + :vartype value: list[~storage_cache_management_client.models.ApiOperation] """ _attribute_map = { @@ -96,6 +119,13 @@ def __init__( self, **kwargs ): + """ + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + :keyword value: List of Resource Provider operations supported by the Microsoft.StorageCache + resource provider. + :paramtype value: list[~storage_cache_management_client.models.ApiOperation] + """ super(ApiOperationListResult, self).__init__(**kwargs) self.next_link = kwargs.get('next_link', None) self.value = kwargs.get('value', None) @@ -104,8 +134,9 @@ def __init__( class ApiOperationPropertiesServiceSpecification(msrest.serialization.Model): """Specification of the all the metrics provided for a resource type. - :param metric_specifications: Details about operations related to metrics. - :type metric_specifications: list[~storage_cache_management_client.models.MetricSpecification] + :ivar metric_specifications: Details about operations related to metrics. + :vartype metric_specifications: + list[~storage_cache_management_client.models.MetricSpecification] """ _attribute_map = { @@ -116,6 +147,11 @@ def __init__( self, **kwargs ): + """ + :keyword metric_specifications: Details about operations related to metrics. + :paramtype metric_specifications: + list[~storage_cache_management_client.models.MetricSpecification] + """ super(ApiOperationPropertiesServiceSpecification, self).__init__(**kwargs) self.metric_specifications = kwargs.get('metric_specifications', None) @@ -123,20 +159,20 @@ def __init__( class AscOperation(msrest.serialization.Model): """The status of operation. - :param id: The operation Id. - :type id: str - :param name: The operation name. - :type name: str - :param start_time: The start time of the operation. - :type start_time: str - :param end_time: The end time of the operation. - :type end_time: str - :param status: The status of the operation. - :type status: str - :param error: The error detail of the operation if any. - :type error: ~storage_cache_management_client.models.ErrorResponse - :param output: Additional operation-specific output. - :type output: dict[str, any] + :ivar id: The operation Id. + :vartype id: str + :ivar name: The operation name. + :vartype name: str + :ivar start_time: The start time of the operation. + :vartype start_time: str + :ivar end_time: The end time of the operation. + :vartype end_time: str + :ivar status: The status of the operation. + :vartype status: str + :ivar error: The error detail of the operation if any. + :vartype error: ~storage_cache_management_client.models.ErrorResponse + :ivar output: Additional operation-specific output. + :vartype output: dict[str, any] """ _attribute_map = { @@ -153,6 +189,22 @@ def __init__( self, **kwargs ): + """ + :keyword id: The operation Id. + :paramtype id: str + :keyword name: The operation name. + :paramtype name: str + :keyword start_time: The start time of the operation. + :paramtype start_time: str + :keyword end_time: The end time of the operation. + :paramtype end_time: str + :keyword status: The status of the operation. + :paramtype status: str + :keyword error: The error detail of the operation if any. + :paramtype error: ~storage_cache_management_client.models.ErrorResponse + :keyword output: Additional operation-specific output. + :paramtype output: dict[str, any] + """ super(AscOperation, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = kwargs.get('name', None) @@ -166,10 +218,10 @@ def __init__( class BlobNfsTarget(msrest.serialization.Model): """Properties pertaining to the BlobNfsTarget. - :param target: Resource ID of the storage container. - :type target: str - :param usage_model: Identifies the StorageCache usage model to be used for this storage target. - :type usage_model: str + :ivar target: Resource ID of the storage container. + :vartype target: str + :ivar usage_model: Identifies the StorageCache usage model to be used for this storage target. + :vartype usage_model: str """ _attribute_map = { @@ -181,6 +233,13 @@ def __init__( self, **kwargs ): + """ + :keyword target: Resource ID of the storage container. + :paramtype target: str + :keyword usage_model: Identifies the StorageCache usage model to be used for this storage + target. + :paramtype usage_model: str + """ super(BlobNfsTarget, self).__init__(**kwargs) self.target = kwargs.get('target', None) self.usage_model = kwargs.get('usage_model', None) @@ -191,24 +250,24 @@ class Cache(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar id: Resource ID of the Cache. :vartype id: str - :param location: Region name string. - :type location: str + :ivar location: Region name string. + :vartype location: str :ivar name: Name of Cache. :vartype name: str :ivar type: Type of the Cache; Microsoft.StorageCache/Cache. :vartype type: str - :param identity: The identity of the cache, if configured. - :type identity: ~storage_cache_management_client.models.CacheIdentity + :ivar identity: The identity of the cache, if configured. + :vartype identity: ~storage_cache_management_client.models.CacheIdentity :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~storage_cache_management_client.models.SystemData - :param sku: SKU for the Cache. - :type sku: ~storage_cache_management_client.models.CacheSku - :param cache_size_gb: The size of this Cache, in GB. - :type cache_size_gb: int + :ivar sku: SKU for the Cache. + :vartype sku: ~storage_cache_management_client.models.CacheSku + :ivar cache_size_gb: The size of this Cache, in GB. + :vartype cache_size_gb: int :ivar health: Health of the Cache. :vartype health: ~storage_cache_management_client.models.CacheHealth :ivar mount_addresses: Array of IP addresses that can be used by clients mounting this Cache. @@ -219,18 +278,18 @@ class Cache(msrest.serialization.Model): "Updating". :vartype provisioning_state: str or ~storage_cache_management_client.models.ProvisioningStateType - :param subnet: Subnet used for the Cache. - :type subnet: str + :ivar subnet: Subnet used for the Cache. + :vartype subnet: str :ivar upgrade_status: Upgrade status of the Cache. :vartype upgrade_status: ~storage_cache_management_client.models.CacheUpgradeStatus - :param network_settings: Specifies network settings of the cache. - :type network_settings: ~storage_cache_management_client.models.CacheNetworkSettings - :param encryption_settings: Specifies encryption settings of the cache. - :type encryption_settings: ~storage_cache_management_client.models.CacheEncryptionSettings - :param security_settings: Specifies security settings of the cache. - :type security_settings: ~storage_cache_management_client.models.CacheSecuritySettings - :param directory_services_settings: Specifies Directory Services settings of the cache. - :type directory_services_settings: + :ivar network_settings: Specifies network settings of the cache. + :vartype network_settings: ~storage_cache_management_client.models.CacheNetworkSettings + :ivar encryption_settings: Specifies encryption settings of the cache. + :vartype encryption_settings: ~storage_cache_management_client.models.CacheEncryptionSettings + :ivar security_settings: Specifies security settings of the cache. + :vartype security_settings: ~storage_cache_management_client.models.CacheSecuritySettings + :ivar directory_services_settings: Specifies Directory Services settings of the cache. + :vartype directory_services_settings: ~storage_cache_management_client.models.CacheDirectorySettings """ @@ -270,6 +329,29 @@ def __init__( self, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Region name string. + :paramtype location: str + :keyword identity: The identity of the cache, if configured. + :paramtype identity: ~storage_cache_management_client.models.CacheIdentity + :keyword sku: SKU for the Cache. + :paramtype sku: ~storage_cache_management_client.models.CacheSku + :keyword cache_size_gb: The size of this Cache, in GB. + :paramtype cache_size_gb: int + :keyword subnet: Subnet used for the Cache. + :paramtype subnet: str + :keyword network_settings: Specifies network settings of the cache. + :paramtype network_settings: ~storage_cache_management_client.models.CacheNetworkSettings + :keyword encryption_settings: Specifies encryption settings of the cache. + :paramtype encryption_settings: ~storage_cache_management_client.models.CacheEncryptionSettings + :keyword security_settings: Specifies security settings of the cache. + :paramtype security_settings: ~storage_cache_management_client.models.CacheSecuritySettings + :keyword directory_services_settings: Specifies Directory Services settings of the cache. + :paramtype directory_services_settings: + ~storage_cache_management_client.models.CacheDirectorySettings + """ super(Cache, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) self.id = None @@ -298,26 +380,26 @@ class CacheActiveDirectorySettings(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param primary_dns_ip_address: Required. Primary DNS IP address used to resolve the Active + :ivar primary_dns_ip_address: Required. Primary DNS IP address used to resolve the Active Directory domain controller's fully qualified domain name. - :type primary_dns_ip_address: str - :param secondary_dns_ip_address: Secondary DNS IP address used to resolve the Active Directory + :vartype primary_dns_ip_address: str + :ivar secondary_dns_ip_address: Secondary DNS IP address used to resolve the Active Directory domain controller's fully qualified domain name. - :type secondary_dns_ip_address: str - :param domain_name: Required. The fully qualified domain name of the Active Directory domain + :vartype secondary_dns_ip_address: str + :ivar domain_name: Required. The fully qualified domain name of the Active Directory domain controller. - :type domain_name: str - :param domain_net_bios_name: Required. The Active Directory domain's NetBIOS name. - :type domain_net_bios_name: str - :param cache_net_bios_name: Required. The NetBIOS name to assign to the HPC Cache when it joins + :vartype domain_name: str + :ivar domain_net_bios_name: Required. The Active Directory domain's NetBIOS name. + :vartype domain_net_bios_name: str + :ivar cache_net_bios_name: Required. The NetBIOS name to assign to the HPC Cache when it joins the Active Directory domain as a server. Length must 1-15 characters from the class [-0-9a-zA-Z]. - :type cache_net_bios_name: str + :vartype cache_net_bios_name: str :ivar domain_joined: True if the HPC Cache is joined to the Active Directory domain. Possible values include: "Yes", "No", "Error". :vartype domain_joined: str or ~storage_cache_management_client.models.DomainJoinedType - :param credentials: Active Directory admin credentials used to join the HPC Cache to a domain. - :type credentials: + :ivar credentials: Active Directory admin credentials used to join the HPC Cache to a domain. + :vartype credentials: ~storage_cache_management_client.models.CacheActiveDirectorySettingsCredentials """ @@ -343,6 +425,27 @@ def __init__( self, **kwargs ): + """ + :keyword primary_dns_ip_address: Required. Primary DNS IP address used to resolve the Active + Directory domain controller's fully qualified domain name. + :paramtype primary_dns_ip_address: str + :keyword secondary_dns_ip_address: Secondary DNS IP address used to resolve the Active + Directory domain controller's fully qualified domain name. + :paramtype secondary_dns_ip_address: str + :keyword domain_name: Required. The fully qualified domain name of the Active Directory domain + controller. + :paramtype domain_name: str + :keyword domain_net_bios_name: Required. The Active Directory domain's NetBIOS name. + :paramtype domain_net_bios_name: str + :keyword cache_net_bios_name: Required. The NetBIOS name to assign to the HPC Cache when it + joins the Active Directory domain as a server. Length must 1-15 characters from the class + [-0-9a-zA-Z]. + :paramtype cache_net_bios_name: str + :keyword credentials: Active Directory admin credentials used to join the HPC Cache to a + domain. + :paramtype credentials: + ~storage_cache_management_client.models.CacheActiveDirectorySettingsCredentials + """ super(CacheActiveDirectorySettings, self).__init__(**kwargs) self.primary_dns_ip_address = kwargs['primary_dns_ip_address'] self.secondary_dns_ip_address = kwargs.get('secondary_dns_ip_address', None) @@ -358,12 +461,12 @@ class CacheActiveDirectorySettingsCredentials(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param username: Required. Username of the Active Directory domain administrator. This value is + :ivar username: Required. Username of the Active Directory domain administrator. This value is stored encrypted and not returned on response. - :type username: str - :param password: Required. Plain text password of the Active Directory domain administrator. + :vartype username: str + :ivar password: Required. Plain text password of the Active Directory domain administrator. This value is stored encrypted and not returned on response. - :type password: str + :vartype password: str """ _validation = { @@ -380,6 +483,14 @@ def __init__( self, **kwargs ): + """ + :keyword username: Required. Username of the Active Directory domain administrator. This value + is stored encrypted and not returned on response. + :paramtype username: str + :keyword password: Required. Plain text password of the Active Directory domain administrator. + This value is stored encrypted and not returned on response. + :paramtype password: str + """ super(CacheActiveDirectorySettingsCredentials, self).__init__(**kwargs) self.username = kwargs['username'] self.password = kwargs['password'] @@ -388,12 +499,13 @@ def __init__( class CacheDirectorySettings(msrest.serialization.Model): """Cache Directory Services settings. - :param active_directory: Specifies settings for joining the HPC Cache to an Active Directory + :ivar active_directory: Specifies settings for joining the HPC Cache to an Active Directory domain. - :type active_directory: ~storage_cache_management_client.models.CacheActiveDirectorySettings - :param username_download: Specifies settings for Extended Groups. Extended Groups allows users + :vartype active_directory: ~storage_cache_management_client.models.CacheActiveDirectorySettings + :ivar username_download: Specifies settings for Extended Groups. Extended Groups allows users to be members of more than 16 groups. - :type username_download: ~storage_cache_management_client.models.CacheUsernameDownloadSettings + :vartype username_download: + ~storage_cache_management_client.models.CacheUsernameDownloadSettings """ _attribute_map = { @@ -405,6 +517,16 @@ def __init__( self, **kwargs ): + """ + :keyword active_directory: Specifies settings for joining the HPC Cache to an Active Directory + domain. + :paramtype active_directory: + ~storage_cache_management_client.models.CacheActiveDirectorySettings + :keyword username_download: Specifies settings for Extended Groups. Extended Groups allows + users to be members of more than 16 groups. + :paramtype username_download: + ~storage_cache_management_client.models.CacheUsernameDownloadSettings + """ super(CacheDirectorySettings, self).__init__(**kwargs) self.active_directory = kwargs.get('active_directory', None) self.username_download = kwargs.get('username_download', None) @@ -413,11 +535,11 @@ def __init__( class CacheEncryptionSettings(msrest.serialization.Model): """Cache encryption settings. - :param key_encryption_key: Specifies the location of the key encryption key in Key Vault. - :type key_encryption_key: ~storage_cache_management_client.models.KeyVaultKeyReference - :param rotation_to_latest_key_version_enabled: Specifies whether the service will automatically + :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :vartype key_encryption_key: ~storage_cache_management_client.models.KeyVaultKeyReference + :ivar rotation_to_latest_key_version_enabled: Specifies whether the service will automatically rotate to the newest version of the key in the Key Vault. - :type rotation_to_latest_key_version_enabled: bool + :vartype rotation_to_latest_key_version_enabled: bool """ _attribute_map = { @@ -429,6 +551,13 @@ def __init__( self, **kwargs ): + """ + :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :paramtype key_encryption_key: ~storage_cache_management_client.models.KeyVaultKeyReference + :keyword rotation_to_latest_key_version_enabled: Specifies whether the service will + automatically rotate to the newest version of the key in the Key Vault. + :paramtype rotation_to_latest_key_version_enabled: bool + """ super(CacheEncryptionSettings, self).__init__(**kwargs) self.key_encryption_key = kwargs.get('key_encryption_key', None) self.rotation_to_latest_key_version_enabled = kwargs.get('rotation_to_latest_key_version_enabled', None) @@ -439,11 +568,11 @@ class CacheHealth(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param state: List of Cache health states. Possible values include: "Unknown", "Healthy", + :ivar state: List of Cache health states. Possible values include: "Unknown", "Healthy", "Degraded", "Down", "Transitioning", "Stopping", "Stopped", "Upgrading", "Flushing". - :type state: str or ~storage_cache_management_client.models.HealthStateType - :param status_description: Describes explanation of state. - :type status_description: str + :vartype state: str or ~storage_cache_management_client.models.HealthStateType + :ivar status_description: Describes explanation of state. + :vartype status_description: str :ivar conditions: Outstanding conditions that need to be investigated and resolved. :vartype conditions: list[~storage_cache_management_client.models.Condition] """ @@ -462,6 +591,13 @@ def __init__( self, **kwargs ): + """ + :keyword state: List of Cache health states. Possible values include: "Unknown", "Healthy", + "Degraded", "Down", "Transitioning", "Stopping", "Stopped", "Upgrading", "Flushing". + :paramtype state: str or ~storage_cache_management_client.models.HealthStateType + :keyword status_description: Describes explanation of state. + :paramtype status_description: str + """ super(CacheHealth, self).__init__(**kwargs) self.state = kwargs.get('state', None) self.status_description = kwargs.get('status_description', None) @@ -477,12 +613,12 @@ class CacheIdentity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID associated with the cache. :vartype tenant_id: str - :param type: The type of identity used for the cache. Possible values include: - "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :type type: str or ~storage_cache_management_client.models.CacheIdentityType - :param user_assigned_identities: A dictionary where each key is a user assigned identity + :ivar type: The type of identity used for the cache. Possible values include: "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned", "None". + :vartype type: str or ~storage_cache_management_client.models.CacheIdentityType + :ivar user_assigned_identities: A dictionary where each key is a user assigned identity resource ID, and each key's value is an empty dictionary. - :type user_assigned_identities: dict[str, + :vartype user_assigned_identities: dict[str, ~storage_cache_management_client.models.UserAssignedIdentitiesValue] """ @@ -502,6 +638,15 @@ def __init__( self, **kwargs ): + """ + :keyword type: The type of identity used for the cache. Possible values include: + "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". + :paramtype type: str or ~storage_cache_management_client.models.CacheIdentityType + :keyword user_assigned_identities: A dictionary where each key is a user assigned identity + resource ID, and each key's value is an empty dictionary. + :paramtype user_assigned_identities: dict[str, + ~storage_cache_management_client.models.UserAssignedIdentitiesValue] + """ super(CacheIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -514,18 +659,18 @@ class CacheNetworkSettings(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param mtu: The IPv4 maximum transmission unit configured for the subnet. - :type mtu: int + :ivar mtu: The IPv4 maximum transmission unit configured for the subnet. + :vartype mtu: int :ivar utility_addresses: Array of additional IP addresses used by this Cache. :vartype utility_addresses: list[str] - :param dns_servers: DNS servers for the cache to use. It will be set from the network + :ivar dns_servers: DNS servers for the cache to use. It will be set from the network configuration if no value is provided. - :type dns_servers: list[str] - :param dns_search_domain: DNS search domain. - :type dns_search_domain: str - :param ntp_server: NTP server IP Address or FQDN for the cache to use. The default is + :vartype dns_servers: list[str] + :ivar dns_search_domain: DNS search domain. + :vartype dns_search_domain: str + :ivar ntp_server: NTP server IP Address or FQDN for the cache to use. The default is time.windows.com. - :type ntp_server: str + :vartype ntp_server: str """ _validation = { @@ -545,6 +690,18 @@ def __init__( self, **kwargs ): + """ + :keyword mtu: The IPv4 maximum transmission unit configured for the subnet. + :paramtype mtu: int + :keyword dns_servers: DNS servers for the cache to use. It will be set from the network + configuration if no value is provided. + :paramtype dns_servers: list[str] + :keyword dns_search_domain: DNS search domain. + :paramtype dns_search_domain: str + :keyword ntp_server: NTP server IP Address or FQDN for the cache to use. The default is + time.windows.com. + :paramtype ntp_server: str + """ super(CacheNetworkSettings, self).__init__(**kwargs) self.mtu = kwargs.get('mtu', 1500) self.utility_addresses = None @@ -556,8 +713,8 @@ def __init__( class CacheSecuritySettings(msrest.serialization.Model): """Cache security settings. - :param access_policies: NFS access policies defined for this cache. - :type access_policies: list[~storage_cache_management_client.models.NfsAccessPolicy] + :ivar access_policies: NFS access policies defined for this cache. + :vartype access_policies: list[~storage_cache_management_client.models.NfsAccessPolicy] """ _attribute_map = { @@ -568,6 +725,10 @@ def __init__( self, **kwargs ): + """ + :keyword access_policies: NFS access policies defined for this cache. + :paramtype access_policies: list[~storage_cache_management_client.models.NfsAccessPolicy] + """ super(CacheSecuritySettings, self).__init__(**kwargs) self.access_policies = kwargs.get('access_policies', None) @@ -575,8 +736,8 @@ def __init__( class CacheSku(msrest.serialization.Model): """SKU for the Cache. - :param name: SKU name for this Cache. - :type name: str + :ivar name: SKU name for this Cache. + :vartype name: str """ _attribute_map = { @@ -587,6 +748,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: SKU name for this Cache. + :paramtype name: str + """ super(CacheSku, self).__init__(**kwargs) self.name = kwargs.get('name', None) @@ -594,10 +759,10 @@ def __init__( class CachesListResult(msrest.serialization.Model): """Result of the request to list Caches. It contains a list of Caches and a URL link to get the next set of results. - :param next_link: URL to get the next set of Cache list results, if there are any. - :type next_link: str - :param value: List of Caches. - :type value: list[~storage_cache_management_client.models.Cache] + :ivar next_link: URL to get the next set of Cache list results, if there are any. + :vartype next_link: str + :ivar value: List of Caches. + :vartype value: list[~storage_cache_management_client.models.Cache] """ _attribute_map = { @@ -609,6 +774,12 @@ def __init__( self, **kwargs ): + """ + :keyword next_link: URL to get the next set of Cache list results, if there are any. + :paramtype next_link: str + :keyword value: List of Caches. + :paramtype value: list[~storage_cache_management_client.models.Cache] + """ super(CachesListResult, self).__init__(**kwargs) self.next_link = kwargs.get('next_link', None) self.value = kwargs.get('value', None) @@ -658,6 +829,8 @@ def __init__( self, **kwargs ): + """ + """ super(CacheUpgradeStatus, self).__init__(**kwargs) self.current_firmware_version = None self.firmware_update_status = None @@ -671,38 +844,38 @@ class CacheUsernameDownloadSettings(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param extended_groups: Whether or not Extended Groups is enabled. - :type extended_groups: bool - :param username_source: This setting determines how the cache gets username and group names for + :ivar extended_groups: Whether or not Extended Groups is enabled. + :vartype extended_groups: bool + :ivar username_source: This setting determines how the cache gets username and group names for clients. Possible values include: "AD", "LDAP", "File", "None". Default value: "None". - :type username_source: str or ~storage_cache_management_client.models.UsernameSource - :param group_file_uri: The URI of the file containing group information (in /etc/group file + :vartype username_source: str or ~storage_cache_management_client.models.UsernameSource + :ivar group_file_uri: The URI of the file containing group information (in /etc/group file format). This field must be populated when 'usernameSource' is set to 'File'. - :type group_file_uri: str - :param user_file_uri: The URI of the file containing user information (in /etc/passwd file + :vartype group_file_uri: str + :ivar user_file_uri: The URI of the file containing user information (in /etc/passwd file format). This field must be populated when 'usernameSource' is set to 'File'. - :type user_file_uri: str - :param ldap_server: The fully qualified domain name or IP address of the LDAP server to use. - :type ldap_server: str - :param ldap_base_dn: The base distinguished name for the LDAP domain. - :type ldap_base_dn: str - :param encrypt_ldap_connection: Whether or not the LDAP connection should be encrypted. - :type encrypt_ldap_connection: bool - :param require_valid_certificate: Determines if the certificates must be validated by a + :vartype user_file_uri: str + :ivar ldap_server: The fully qualified domain name or IP address of the LDAP server to use. + :vartype ldap_server: str + :ivar ldap_base_dn: The base distinguished name for the LDAP domain. + :vartype ldap_base_dn: str + :ivar encrypt_ldap_connection: Whether or not the LDAP connection should be encrypted. + :vartype encrypt_ldap_connection: bool + :ivar require_valid_certificate: Determines if the certificates must be validated by a certificate authority. When true, caCertificateURI must be provided. - :type require_valid_certificate: bool - :param auto_download_certificate: Determines if the certificate should be automatically + :vartype require_valid_certificate: bool + :ivar auto_download_certificate: Determines if the certificate should be automatically downloaded. This applies to 'caCertificateURI' only if 'requireValidCertificate' is true. - :type auto_download_certificate: bool - :param ca_certificate_uri: The URI of the CA certificate to validate the LDAP secure - connection. This field must be populated when 'requireValidCertificate' is set to true. - :type ca_certificate_uri: str + :vartype auto_download_certificate: bool + :ivar ca_certificate_uri: The URI of the CA certificate to validate the LDAP secure connection. + This field must be populated when 'requireValidCertificate' is set to true. + :vartype ca_certificate_uri: str :ivar username_downloaded: Indicates whether or not the HPC Cache has performed the username download successfully. Possible values include: "Yes", "No", "Error". :vartype username_downloaded: str or ~storage_cache_management_client.models.UsernameDownloadedType - :param credentials: When present, these are the credentials for the secure LDAP connection. - :type credentials: + :ivar credentials: When present, these are the credentials for the secure LDAP connection. + :vartype credentials: ~storage_cache_management_client.models.CacheUsernameDownloadSettingsCredentials """ @@ -729,6 +902,37 @@ def __init__( self, **kwargs ): + """ + :keyword extended_groups: Whether or not Extended Groups is enabled. + :paramtype extended_groups: bool + :keyword username_source: This setting determines how the cache gets username and group names + for clients. Possible values include: "AD", "LDAP", "File", "None". Default value: "None". + :paramtype username_source: str or ~storage_cache_management_client.models.UsernameSource + :keyword group_file_uri: The URI of the file containing group information (in /etc/group file + format). This field must be populated when 'usernameSource' is set to 'File'. + :paramtype group_file_uri: str + :keyword user_file_uri: The URI of the file containing user information (in /etc/passwd file + format). This field must be populated when 'usernameSource' is set to 'File'. + :paramtype user_file_uri: str + :keyword ldap_server: The fully qualified domain name or IP address of the LDAP server to use. + :paramtype ldap_server: str + :keyword ldap_base_dn: The base distinguished name for the LDAP domain. + :paramtype ldap_base_dn: str + :keyword encrypt_ldap_connection: Whether or not the LDAP connection should be encrypted. + :paramtype encrypt_ldap_connection: bool + :keyword require_valid_certificate: Determines if the certificates must be validated by a + certificate authority. When true, caCertificateURI must be provided. + :paramtype require_valid_certificate: bool + :keyword auto_download_certificate: Determines if the certificate should be automatically + downloaded. This applies to 'caCertificateURI' only if 'requireValidCertificate' is true. + :paramtype auto_download_certificate: bool + :keyword ca_certificate_uri: The URI of the CA certificate to validate the LDAP secure + connection. This field must be populated when 'requireValidCertificate' is set to true. + :paramtype ca_certificate_uri: str + :keyword credentials: When present, these are the credentials for the secure LDAP connection. + :paramtype credentials: + ~storage_cache_management_client.models.CacheUsernameDownloadSettingsCredentials + """ super(CacheUsernameDownloadSettings, self).__init__(**kwargs) self.extended_groups = kwargs.get('extended_groups', None) self.username_source = kwargs.get('username_source', "None") @@ -747,12 +951,12 @@ def __init__( class CacheUsernameDownloadSettingsCredentials(msrest.serialization.Model): """When present, these are the credentials for the secure LDAP connection. - :param bind_dn: The Bind Distinguished Name identity to be used in the secure LDAP connection. + :ivar bind_dn: The Bind Distinguished Name identity to be used in the secure LDAP connection. This value is stored encrypted and not returned on response. - :type bind_dn: str - :param bind_password: The Bind password to be used in the secure LDAP connection. This value is + :vartype bind_dn: str + :ivar bind_password: The Bind password to be used in the secure LDAP connection. This value is stored encrypted and not returned on response. - :type bind_password: str + :vartype bind_password: str """ _attribute_map = { @@ -764,6 +968,14 @@ def __init__( self, **kwargs ): + """ + :keyword bind_dn: The Bind Distinguished Name identity to be used in the secure LDAP + connection. This value is stored encrypted and not returned on response. + :paramtype bind_dn: str + :keyword bind_password: The Bind password to be used in the secure LDAP connection. This value + is stored encrypted and not returned on response. + :paramtype bind_password: str + """ super(CacheUsernameDownloadSettingsCredentials, self).__init__(**kwargs) self.bind_dn = kwargs.get('bind_dn', None) self.bind_password = kwargs.get('bind_password', None) @@ -772,8 +984,8 @@ def __init__( class ClfsTarget(msrest.serialization.Model): """Properties pertaining to the ClfsTarget. - :param target: Resource ID of storage container. - :type target: str + :ivar target: Resource ID of storage container. + :vartype target: str """ _attribute_map = { @@ -784,6 +996,10 @@ def __init__( self, **kwargs ): + """ + :keyword target: Resource ID of storage container. + :paramtype target: str + """ super(ClfsTarget, self).__init__(**kwargs) self.target = kwargs.get('target', None) @@ -791,17 +1007,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param details: A list of additional details about the error. - :type details: list[~storage_cache_management_client.models.CloudErrorBody] - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar details: A list of additional details about the error. + :vartype details: list[~storage_cache_management_client.models.CloudErrorBody] + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str + :vartype target: str """ _attribute_map = { @@ -815,6 +1031,19 @@ def __init__( self, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~storage_cache_management_client.models.CloudErrorBody] + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.details = kwargs.get('details', None) @@ -847,6 +1076,8 @@ def __init__( self, **kwargs ): + """ + """ super(Condition, self).__init__(**kwargs) self.timestamp = None self.message = None @@ -855,10 +1086,10 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Describes the format of Error response. - :param code: Error code. - :type code: str - :param message: Error message indicating why the operation failed. - :type message: str + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str """ _attribute_map = { @@ -870,6 +1101,12 @@ def __init__( self, **kwargs ): + """ + :keyword code: Error code. + :paramtype code: str + :keyword message: Error message indicating why the operation failed. + :paramtype message: str + """ super(ErrorResponse, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -880,10 +1117,10 @@ class KeyVaultKeyReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_url: Required. The URL referencing a key encryption key in Key Vault. - :type key_url: str - :param source_vault: Required. Describes a resource Id to source Key Vault. - :type source_vault: ~storage_cache_management_client.models.KeyVaultKeyReferenceSourceVault + :ivar key_url: Required. The URL referencing a key encryption key in Key Vault. + :vartype key_url: str + :ivar source_vault: Required. Describes a resource Id to source Key Vault. + :vartype source_vault: ~storage_cache_management_client.models.KeyVaultKeyReferenceSourceVault """ _validation = { @@ -900,6 +1137,13 @@ def __init__( self, **kwargs ): + """ + :keyword key_url: Required. The URL referencing a key encryption key in Key Vault. + :paramtype key_url: str + :keyword source_vault: Required. Describes a resource Id to source Key Vault. + :paramtype source_vault: + ~storage_cache_management_client.models.KeyVaultKeyReferenceSourceVault + """ super(KeyVaultKeyReference, self).__init__(**kwargs) self.key_url = kwargs['key_url'] self.source_vault = kwargs['source_vault'] @@ -908,8 +1152,8 @@ def __init__( class KeyVaultKeyReferenceSourceVault(msrest.serialization.Model): """Describes a resource Id to source Key Vault. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -920,6 +1164,10 @@ def __init__( self, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(KeyVaultKeyReferenceSourceVault, self).__init__(**kwargs) self.id = kwargs.get('id', None) @@ -927,14 +1175,14 @@ def __init__( class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension. - :type name: str - :param display_name: Localized friendly display name of the dimension. - :type display_name: str - :param internal_name: Internal name of the dimension. - :type internal_name: str - :param to_be_exported_for_shoebox: To be exported to shoe box. - :type to_be_exported_for_shoebox: bool + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar internal_name: Internal name of the dimension. + :vartype internal_name: str + :ivar to_be_exported_for_shoebox: To be exported to shoe box. + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -948,6 +1196,16 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword internal_name: Internal name of the dimension. + :paramtype internal_name: str + :keyword to_be_exported_for_shoebox: To be exported to shoe box. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimension, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -958,23 +1216,23 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Details about operation related to metrics. - :param name: The name of the metric. - :type name: str - :param display_name: Localized display name of the metric. - :type display_name: str - :param display_description: The description of the metric. - :type display_description: str - :param unit: The unit that the metric is measured in. - :type unit: str - :param aggregation_type: The type of metric aggregation. - :type aggregation_type: str - :param supported_aggregation_types: Support metric aggregation type. - :type supported_aggregation_types: list[str or + :ivar name: The name of the metric. + :vartype name: str + :ivar display_name: Localized display name of the metric. + :vartype display_name: str + :ivar display_description: The description of the metric. + :vartype display_description: str + :ivar unit: The unit that the metric is measured in. + :vartype unit: str + :ivar aggregation_type: The type of metric aggregation. + :vartype aggregation_type: str + :ivar supported_aggregation_types: Support metric aggregation type. + :vartype supported_aggregation_types: list[str or ~storage_cache_management_client.models.MetricAggregationType] - :param metric_class: Type of metrics. - :type metric_class: str - :param dimensions: Dimensions of the metric. - :type dimensions: list[~storage_cache_management_client.models.MetricDimension] + :ivar metric_class: Type of metrics. + :vartype metric_class: str + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~storage_cache_management_client.models.MetricDimension] """ _attribute_map = { @@ -992,6 +1250,25 @@ def __init__( self, **kwargs ): + """ + :keyword name: The name of the metric. + :paramtype name: str + :keyword display_name: Localized display name of the metric. + :paramtype display_name: str + :keyword display_description: The description of the metric. + :paramtype display_description: str + :keyword unit: The unit that the metric is measured in. + :paramtype unit: str + :keyword aggregation_type: The type of metric aggregation. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Support metric aggregation type. + :paramtype supported_aggregation_types: list[str or + ~storage_cache_management_client.models.MetricAggregationType] + :keyword metric_class: Type of metrics. + :paramtype metric_class: str + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~storage_cache_management_client.models.MetricDimension] + """ super(MetricSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1006,14 +1283,14 @@ def __init__( class NamespaceJunction(msrest.serialization.Model): """A namespace junction. - :param namespace_path: Namespace path on a Cache for a Storage Target. - :type namespace_path: str - :param target_path: Path in Storage Target to which namespacePath points. - :type target_path: str - :param nfs_export: NFS export where targetPath exists. - :type nfs_export: str - :param nfs_access_policy: Name of the access policy applied to this junction. - :type nfs_access_policy: str + :ivar namespace_path: Namespace path on a Cache for a Storage Target. + :vartype namespace_path: str + :ivar target_path: Path in Storage Target to which namespacePath points. + :vartype target_path: str + :ivar nfs_export: NFS export where targetPath exists. + :vartype nfs_export: str + :ivar nfs_access_policy: Name of the access policy applied to this junction. + :vartype nfs_access_policy: str """ _attribute_map = { @@ -1027,6 +1304,16 @@ def __init__( self, **kwargs ): + """ + :keyword namespace_path: Namespace path on a Cache for a Storage Target. + :paramtype namespace_path: str + :keyword target_path: Path in Storage Target to which namespacePath points. + :paramtype target_path: str + :keyword nfs_export: NFS export where targetPath exists. + :paramtype nfs_export: str + :keyword nfs_access_policy: Name of the access policy applied to this junction. + :paramtype nfs_access_policy: str + """ super(NamespaceJunction, self).__init__(**kwargs) self.namespace_path = kwargs.get('namespace_path', None) self.target_path = kwargs.get('target_path', None) @@ -1037,10 +1324,10 @@ def __init__( class Nfs3Target(msrest.serialization.Model): """Properties pertaining to the Nfs3Target. - :param target: IP address or host name of an NFSv3 host (e.g., 10.0.44.44). - :type target: str - :param usage_model: Identifies the StorageCache usage model to be used for this storage target. - :type usage_model: str + :ivar target: IP address or host name of an NFSv3 host (e.g., 10.0.44.44). + :vartype target: str + :ivar usage_model: Identifies the StorageCache usage model to be used for this storage target. + :vartype usage_model: str """ _validation = { @@ -1056,6 +1343,13 @@ def __init__( self, **kwargs ): + """ + :keyword target: IP address or host name of an NFSv3 host (e.g., 10.0.44.44). + :paramtype target: str + :keyword usage_model: Identifies the StorageCache usage model to be used for this storage + target. + :paramtype usage_model: str + """ super(Nfs3Target, self).__init__(**kwargs) self.target = kwargs.get('target', None) self.usage_model = kwargs.get('usage_model', None) @@ -1066,12 +1360,11 @@ class NfsAccessPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name identifying this policy. Access Policy names are not case - sensitive. - :type name: str - :param access_rules: Required. The set of rules describing client accesses allowed under this + :ivar name: Required. Name identifying this policy. Access Policy names are not case sensitive. + :vartype name: str + :ivar access_rules: Required. The set of rules describing client accesses allowed under this policy. - :type access_rules: list[~storage_cache_management_client.models.NfsAccessRule] + :vartype access_rules: list[~storage_cache_management_client.models.NfsAccessRule] """ _validation = { @@ -1088,6 +1381,14 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. Name identifying this policy. Access Policy names are not case + sensitive. + :paramtype name: str + :keyword access_rules: Required. The set of rules describing client accesses allowed under this + policy. + :paramtype access_rules: list[~storage_cache_management_client.models.NfsAccessRule] + """ super(NfsAccessPolicy, self).__init__(**kwargs) self.name = kwargs['name'] self.access_rules = kwargs['access_rules'] @@ -1098,32 +1399,31 @@ class NfsAccessRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param scope: Required. Scope for this rule. The scope and filter determine which clients match + :ivar scope: Required. Scope for this rule. The scope and filter determine which clients match the rule. Possible values include: "default", "network", "host". - :type scope: str or ~storage_cache_management_client.models.NfsAccessRuleScope - :param filter: Filter applied to the scope for this rule. The filter's format depends on its + :vartype scope: str or ~storage_cache_management_client.models.NfsAccessRuleScope + :ivar filter: Filter applied to the scope for this rule. The filter's format depends on its scope. 'default' scope matches all clients and has no filter value. 'network' scope takes a filter in CIDR format (for example, 10.99.1.0/24). 'host' takes an IP address or fully qualified domain name as filter. If a client does not match any filter rule and there is no default rule, access is denied. - :type filter: str - :param access: Required. Access allowed by this rule. Possible values include: "no", "ro", - "rw". - :type access: str or ~storage_cache_management_client.models.NfsAccessRuleAccess - :param suid: Allow SUID semantics. - :type suid: bool - :param submount_access: For the default policy, allow access to subdirectories under the root + :vartype filter: str + :ivar access: Required. Access allowed by this rule. Possible values include: "no", "ro", "rw". + :vartype access: str or ~storage_cache_management_client.models.NfsAccessRuleAccess + :ivar suid: Allow SUID semantics. + :vartype suid: bool + :ivar submount_access: For the default policy, allow access to subdirectories under the root export. If this is set to no, clients can only mount the path '/'. If set to yes, clients can mount a deeper path, like '/a/b'. - :type submount_access: bool - :param root_squash: Map root accesses to anonymousUID and anonymousGID. - :type root_squash: bool - :param anonymous_uid: UID value that replaces 0 when rootSquash is true. 65534 will be used if + :vartype submount_access: bool + :ivar root_squash: Map root accesses to anonymousUID and anonymousGID. + :vartype root_squash: bool + :ivar anonymous_uid: UID value that replaces 0 when rootSquash is true. 65534 will be used if not provided. - :type anonymous_uid: str - :param anonymous_gid: GID value that replaces 0 when rootSquash is true. This will use the - value of anonymousUID if not provided. - :type anonymous_gid: str + :vartype anonymous_uid: str + :ivar anonymous_gid: GID value that replaces 0 when rootSquash is true. This will use the value + of anonymousUID if not provided. + :vartype anonymous_gid: str """ _validation = { @@ -1146,6 +1446,34 @@ def __init__( self, **kwargs ): + """ + :keyword scope: Required. Scope for this rule. The scope and filter determine which clients + match the rule. Possible values include: "default", "network", "host". + :paramtype scope: str or ~storage_cache_management_client.models.NfsAccessRuleScope + :keyword filter: Filter applied to the scope for this rule. The filter's format depends on its + scope. 'default' scope matches all clients and has no filter value. 'network' scope takes a + filter in CIDR format (for example, 10.99.1.0/24). 'host' takes an IP address or fully + qualified domain name as filter. If a client does not match any filter rule and there is no + default rule, access is denied. + :paramtype filter: str + :keyword access: Required. Access allowed by this rule. Possible values include: "no", "ro", + "rw". + :paramtype access: str or ~storage_cache_management_client.models.NfsAccessRuleAccess + :keyword suid: Allow SUID semantics. + :paramtype suid: bool + :keyword submount_access: For the default policy, allow access to subdirectories under the root + export. If this is set to no, clients can only mount the path '/'. If set to yes, clients can + mount a deeper path, like '/a/b'. + :paramtype submount_access: bool + :keyword root_squash: Map root accesses to anonymousUID and anonymousGID. + :paramtype root_squash: bool + :keyword anonymous_uid: UID value that replaces 0 when rootSquash is true. 65534 will be used + if not provided. + :paramtype anonymous_uid: str + :keyword anonymous_gid: GID value that replaces 0 when rootSquash is true. This will use the + value of anonymousUID if not provided. + :paramtype anonymous_gid: str + """ super(NfsAccessRule, self).__init__(**kwargs) self.scope = kwargs['scope'] self.filter = kwargs.get('filter', None) @@ -1164,18 +1492,18 @@ class ResourceSku(msrest.serialization.Model): :ivar resource_type: The type of resource the SKU applies to. :vartype resource_type: str - :param capabilities: A list of capabilities of this SKU, such as throughput or ops/sec. - :type capabilities: list[~storage_cache_management_client.models.ResourceSkuCapabilities] + :ivar capabilities: A list of capabilities of this SKU, such as throughput or ops/sec. + :vartype capabilities: list[~storage_cache_management_client.models.ResourceSkuCapabilities] :ivar locations: The set of locations where the SKU is available. This is the supported and registered Azure Geo Regions (e.g., West US, East US, Southeast Asia, etc.). :vartype locations: list[str] - :param location_info: The set of locations where the SKU is available. - :type location_info: list[~storage_cache_management_client.models.ResourceSkuLocationInfo] - :param name: The name of this SKU. - :type name: str - :param restrictions: The restrictions preventing this SKU from being used. This is empty if + :ivar location_info: The set of locations where the SKU is available. + :vartype location_info: list[~storage_cache_management_client.models.ResourceSkuLocationInfo] + :ivar name: The name of this SKU. + :vartype name: str + :ivar restrictions: The restrictions preventing this SKU from being used. This is empty if there are no restrictions. - :type restrictions: list[~storage_cache_management_client.models.Restriction] + :vartype restrictions: list[~storage_cache_management_client.models.Restriction] """ _validation = { @@ -1196,6 +1524,17 @@ def __init__( self, **kwargs ): + """ + :keyword capabilities: A list of capabilities of this SKU, such as throughput or ops/sec. + :paramtype capabilities: list[~storage_cache_management_client.models.ResourceSkuCapabilities] + :keyword location_info: The set of locations where the SKU is available. + :paramtype location_info: list[~storage_cache_management_client.models.ResourceSkuLocationInfo] + :keyword name: The name of this SKU. + :paramtype name: str + :keyword restrictions: The restrictions preventing this SKU from being used. This is empty if + there are no restrictions. + :paramtype restrictions: list[~storage_cache_management_client.models.Restriction] + """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = None self.capabilities = kwargs.get('capabilities', None) @@ -1208,10 +1547,10 @@ def __init__( class ResourceSkuCapabilities(msrest.serialization.Model): """A resource SKU capability. - :param name: Name of a capability, such as ops/sec. - :type name: str - :param value: Quantity, if the capability is measured by quantity. - :type value: str + :ivar name: Name of a capability, such as ops/sec. + :vartype name: str + :ivar value: Quantity, if the capability is measured by quantity. + :vartype value: str """ _attribute_map = { @@ -1223,6 +1562,12 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of a capability, such as ops/sec. + :paramtype name: str + :keyword value: Quantity, if the capability is measured by quantity. + :paramtype value: str + """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) @@ -1231,10 +1576,10 @@ def __init__( class ResourceSkuLocationInfo(msrest.serialization.Model): """Resource SKU location information. - :param location: Location where this SKU is available. - :type location: str - :param zones: Zones if any. - :type zones: list[str] + :ivar location: Location where this SKU is available. + :vartype location: str + :ivar zones: Zones if any. + :vartype zones: list[str] """ _attribute_map = { @@ -1246,6 +1591,12 @@ def __init__( self, **kwargs ): + """ + :keyword location: Location where this SKU is available. + :paramtype location: str + :keyword zones: Zones if any. + :paramtype zones: list[str] + """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.zones = kwargs.get('zones', None) @@ -1256,8 +1607,8 @@ class ResourceSkusResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param next_link: The URI to fetch the next page of Cache SKUs. - :type next_link: str + :ivar next_link: The URI to fetch the next page of Cache SKUs. + :vartype next_link: str :ivar value: The list of SKUs available for the subscription. :vartype value: list[~storage_cache_management_client.models.ResourceSku] """ @@ -1275,6 +1626,10 @@ def __init__( self, **kwargs ): + """ + :keyword next_link: The URI to fetch the next page of Cache SKUs. + :paramtype next_link: str + """ super(ResourceSkusResult, self).__init__(**kwargs) self.next_link = kwargs.get('next_link', None) self.value = None @@ -1291,11 +1646,11 @@ class Restriction(msrest.serialization.Model): :ivar values: The value of restrictions. If the restriction type is set to location, then this would be the different locations where the SKU is restricted. :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or + :ivar reason_code: The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". "QuotaId" is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. "NotAvailableForSubscription" is related to capacity at the datacenter. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~storage_cache_management_client.models.ReasonCode + :vartype reason_code: str or ~storage_cache_management_client.models.ReasonCode """ _validation = { @@ -1313,6 +1668,13 @@ def __init__( self, **kwargs ): + """ + :keyword reason_code: The reason for the restriction. As of now this can be "QuotaId" or + "NotAvailableForSubscription". "QuotaId" is set when the SKU has requiredQuotas parameter as + the subscription does not belong to that quota. "NotAvailableForSubscription" is related to + capacity at the datacenter. Possible values include: "QuotaId", "NotAvailableForSubscription". + :paramtype reason_code: str or ~storage_cache_management_client.models.ReasonCode + """ super(Restriction, self).__init__(**kwargs) self.type = None self.values = None @@ -1356,6 +1718,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageTargetResource, self).__init__(**kwargs) self.name = None self.id = None @@ -1379,28 +1743,28 @@ class StorageTarget(StorageTargetResource): :vartype location: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~storage_cache_management_client.models.SystemData - :param junctions: List of Cache namespace junctions to target for namespace associations. - :type junctions: list[~storage_cache_management_client.models.NamespaceJunction] - :param target_type: Type of the Storage Target. Possible values include: "nfs3", "clfs", + :ivar junctions: List of Cache namespace junctions to target for namespace associations. + :vartype junctions: list[~storage_cache_management_client.models.NamespaceJunction] + :ivar target_type: Type of the Storage Target. Possible values include: "nfs3", "clfs", "unknown", "blobNfs". - :type target_type: str or ~storage_cache_management_client.models.StorageTargetType + :vartype target_type: str or ~storage_cache_management_client.models.StorageTargetType :ivar provisioning_state: ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. Possible values include: "Succeeded", "Failed", "Cancelled", "Creating", "Deleting", "Updating". :vartype provisioning_state: str or ~storage_cache_management_client.models.ProvisioningStateType - :param state: Storage target operational state. Possible values include: "Ready", "Busy", + :ivar state: Storage target operational state. Possible values include: "Ready", "Busy", "Suspended", "Flushing". - :type state: str or ~storage_cache_management_client.models.OperationalStateType - :param nfs3: Properties when targetType is nfs3. - :type nfs3: ~storage_cache_management_client.models.Nfs3Target - :param clfs: Properties when targetType is clfs. - :type clfs: ~storage_cache_management_client.models.ClfsTarget - :param unknown: Properties when targetType is unknown. - :type unknown: ~storage_cache_management_client.models.UnknownTarget - :param blob_nfs: Properties when targetType is blobNfs. - :type blob_nfs: ~storage_cache_management_client.models.BlobNfsTarget + :vartype state: str or ~storage_cache_management_client.models.OperationalStateType + :ivar nfs3: Properties when targetType is nfs3. + :vartype nfs3: ~storage_cache_management_client.models.Nfs3Target + :ivar clfs: Properties when targetType is clfs. + :vartype clfs: ~storage_cache_management_client.models.ClfsTarget + :ivar unknown: Properties when targetType is unknown. + :vartype unknown: ~storage_cache_management_client.models.UnknownTarget + :ivar blob_nfs: Properties when targetType is blobNfs. + :vartype blob_nfs: ~storage_cache_management_client.models.BlobNfsTarget """ _validation = { @@ -1432,6 +1796,24 @@ def __init__( self, **kwargs ): + """ + :keyword junctions: List of Cache namespace junctions to target for namespace associations. + :paramtype junctions: list[~storage_cache_management_client.models.NamespaceJunction] + :keyword target_type: Type of the Storage Target. Possible values include: "nfs3", "clfs", + "unknown", "blobNfs". + :paramtype target_type: str or ~storage_cache_management_client.models.StorageTargetType + :keyword state: Storage target operational state. Possible values include: "Ready", "Busy", + "Suspended", "Flushing". + :paramtype state: str or ~storage_cache_management_client.models.OperationalStateType + :keyword nfs3: Properties when targetType is nfs3. + :paramtype nfs3: ~storage_cache_management_client.models.Nfs3Target + :keyword clfs: Properties when targetType is clfs. + :paramtype clfs: ~storage_cache_management_client.models.ClfsTarget + :keyword unknown: Properties when targetType is unknown. + :paramtype unknown: ~storage_cache_management_client.models.UnknownTarget + :keyword blob_nfs: Properties when targetType is blobNfs. + :paramtype blob_nfs: ~storage_cache_management_client.models.BlobNfsTarget + """ super(StorageTarget, self).__init__(**kwargs) self.junctions = kwargs.get('junctions', None) self.target_type = kwargs.get('target_type', None) @@ -1446,10 +1828,10 @@ def __init__( class StorageTargetsResult(msrest.serialization.Model): """A list of Storage Targets. - :param next_link: The URI to fetch the next page of Storage Targets. - :type next_link: str - :param value: The list of Storage Targets defined for the Cache. - :type value: list[~storage_cache_management_client.models.StorageTarget] + :ivar next_link: The URI to fetch the next page of Storage Targets. + :vartype next_link: str + :ivar value: The list of Storage Targets defined for the Cache. + :vartype value: list[~storage_cache_management_client.models.StorageTarget] """ _attribute_map = { @@ -1461,6 +1843,12 @@ def __init__( self, **kwargs ): + """ + :keyword next_link: The URI to fetch the next page of Storage Targets. + :paramtype next_link: str + :keyword value: The list of Storage Targets defined for the Cache. + :paramtype value: list[~storage_cache_management_client.models.StorageTarget] + """ super(StorageTargetsResult, self).__init__(**kwargs) self.next_link = kwargs.get('next_link', None) self.value = kwargs.get('value', None) @@ -1469,20 +1857,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~storage_cache_management_client.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :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 ~storage_cache_management_client.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". - :type last_modified_by_type: str or ~storage_cache_management_client.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~storage_cache_management_client.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -1498,6 +1886,22 @@ def __init__( self, **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 ~storage_cache_management_client.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 ~storage_cache_management_client.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 = kwargs.get('created_by', None) self.created_by_type = kwargs.get('created_by_type', None) @@ -1510,9 +1914,9 @@ def __init__( class UnknownTarget(msrest.serialization.Model): """Properties pertaining to the UnknownTarget. - :param attributes: Dictionary of string->string pairs containing information about the Storage + :ivar attributes: Dictionary of string->string pairs containing information about the Storage Target. - :type attributes: dict[str, str] + :vartype attributes: dict[str, str] """ _attribute_map = { @@ -1523,6 +1927,11 @@ def __init__( self, **kwargs ): + """ + :keyword attributes: Dictionary of string->string pairs containing information about the + Storage Target. + :paramtype attributes: dict[str, str] + """ super(UnknownTarget, self).__init__(**kwargs) self.attributes = kwargs.get('attributes', None) @@ -1530,13 +1939,13 @@ def __init__( class UsageModel(msrest.serialization.Model): """A usage model. - :param display: Localized information describing this usage model. - :type display: ~storage_cache_management_client.models.UsageModelDisplay - :param model_name: Non-localized keyword name for this usage model. - :type model_name: str - :param target_type: The type of Storage Target to which this model is applicable (only nfs3 as + :ivar display: Localized information describing this usage model. + :vartype display: ~storage_cache_management_client.models.UsageModelDisplay + :ivar model_name: Non-localized keyword name for this usage model. + :vartype model_name: str + :ivar target_type: The type of Storage Target to which this model is applicable (only nfs3 as of this version). - :type target_type: str + :vartype target_type: str """ _attribute_map = { @@ -1549,6 +1958,15 @@ def __init__( self, **kwargs ): + """ + :keyword display: Localized information describing this usage model. + :paramtype display: ~storage_cache_management_client.models.UsageModelDisplay + :keyword model_name: Non-localized keyword name for this usage model. + :paramtype model_name: str + :keyword target_type: The type of Storage Target to which this model is applicable (only nfs3 + as of this version). + :paramtype target_type: str + """ super(UsageModel, self).__init__(**kwargs) self.display = kwargs.get('display', None) self.model_name = kwargs.get('model_name', None) @@ -1558,8 +1976,8 @@ def __init__( class UsageModelDisplay(msrest.serialization.Model): """Localized information describing this usage model. - :param description: String to display for this usage model. - :type description: str + :ivar description: String to display for this usage model. + :vartype description: str """ _attribute_map = { @@ -1570,6 +1988,10 @@ def __init__( self, **kwargs ): + """ + :keyword description: String to display for this usage model. + :paramtype description: str + """ super(UsageModelDisplay, self).__init__(**kwargs) self.description = kwargs.get('description', None) @@ -1577,10 +1999,10 @@ def __init__( class UsageModelsResult(msrest.serialization.Model): """A list of Cache usage models. - :param next_link: The URI to fetch the next page of Cache usage models. - :type next_link: str - :param value: The list of usage models available for the subscription. - :type value: list[~storage_cache_management_client.models.UsageModel] + :ivar next_link: The URI to fetch the next page of Cache usage models. + :vartype next_link: str + :ivar value: The list of usage models available for the subscription. + :vartype value: list[~storage_cache_management_client.models.UsageModel] """ _attribute_map = { @@ -1592,6 +2014,12 @@ def __init__( self, **kwargs ): + """ + :keyword next_link: The URI to fetch the next page of Cache usage models. + :paramtype next_link: str + :keyword value: The list of usage models available for the subscription. + :paramtype value: list[~storage_cache_management_client.models.UsageModel] + """ super(UsageModelsResult, self).__init__(**kwargs) self.next_link = kwargs.get('next_link', None) self.value = kwargs.get('value', None) @@ -1622,6 +2050,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/models/_models_py3.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/models/_models_py3.py index 3ddd000f39e3c..1d889a41d1342 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/models/_models_py3.py @@ -17,17 +17,16 @@ class ApiOperation(msrest.serialization.Model): """REST API operation description: see https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/openapi-authoring-automated-guidelines.md#r3023-operationsapiimplementation. - :param display: The object that represents the operation. - :type display: ~storage_cache_management_client.models.ApiOperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param is_data_action: The flag that indicates whether the operation applies to data plane. - :type is_data_action: bool - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param service_specification: Specification of the all the metrics provided for a resource - type. - :type service_specification: + :ivar display: The object that represents the operation. + :vartype display: ~storage_cache_management_client.models.ApiOperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar is_data_action: The flag that indicates whether the operation applies to data plane. + :vartype is_data_action: bool + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar service_specification: Specification of the all the metrics provided for a resource type. + :vartype service_specification: ~storage_cache_management_client.models.ApiOperationPropertiesServiceSpecification """ @@ -49,6 +48,20 @@ def __init__( service_specification: Optional["ApiOperationPropertiesServiceSpecification"] = None, **kwargs ): + """ + :keyword display: The object that represents the operation. + :paramtype display: ~storage_cache_management_client.models.ApiOperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword is_data_action: The flag that indicates whether the operation applies to data plane. + :paramtype is_data_action: bool + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword service_specification: Specification of the all the metrics provided for a resource + type. + :paramtype service_specification: + ~storage_cache_management_client.models.ApiOperationPropertiesServiceSpecification + """ super(ApiOperation, self).__init__(**kwargs) self.display = display self.origin = origin @@ -60,14 +73,14 @@ def __init__( class ApiOperationDisplay(msrest.serialization.Model): """The object that represents the operation. - :param operation: Operation type: Read, write, delete, etc. - :type operation: str - :param provider: Service provider: Microsoft.StorageCache. - :type provider: str - :param resource: Resource on which the operation is performed: Cache, etc. - :type resource: str - :param description: The description of the operation. - :type description: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + :ivar provider: Service provider: Microsoft.StorageCache. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Cache, etc. + :vartype resource: str + :ivar description: The description of the operation. + :vartype description: str """ _attribute_map = { @@ -86,6 +99,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword operation: Operation type: Read, write, delete, etc. + :paramtype operation: str + :keyword provider: Service provider: Microsoft.StorageCache. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed: Cache, etc. + :paramtype resource: str + :keyword description: The description of the operation. + :paramtype description: str + """ super(ApiOperationDisplay, self).__init__(**kwargs) self.operation = operation self.provider = provider @@ -96,11 +119,11 @@ def __init__( class ApiOperationListResult(msrest.serialization.Model): """Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get the next set of results. - :param next_link: URL to get the next set of operation list results if there are any. - :type next_link: str - :param value: List of Resource Provider operations supported by the Microsoft.StorageCache + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + :ivar value: List of Resource Provider operations supported by the Microsoft.StorageCache resource provider. - :type value: list[~storage_cache_management_client.models.ApiOperation] + :vartype value: list[~storage_cache_management_client.models.ApiOperation] """ _attribute_map = { @@ -115,6 +138,13 @@ def __init__( value: Optional[List["ApiOperation"]] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + :keyword value: List of Resource Provider operations supported by the Microsoft.StorageCache + resource provider. + :paramtype value: list[~storage_cache_management_client.models.ApiOperation] + """ super(ApiOperationListResult, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -123,8 +153,9 @@ def __init__( class ApiOperationPropertiesServiceSpecification(msrest.serialization.Model): """Specification of the all the metrics provided for a resource type. - :param metric_specifications: Details about operations related to metrics. - :type metric_specifications: list[~storage_cache_management_client.models.MetricSpecification] + :ivar metric_specifications: Details about operations related to metrics. + :vartype metric_specifications: + list[~storage_cache_management_client.models.MetricSpecification] """ _attribute_map = { @@ -137,6 +168,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword metric_specifications: Details about operations related to metrics. + :paramtype metric_specifications: + list[~storage_cache_management_client.models.MetricSpecification] + """ super(ApiOperationPropertiesServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -144,20 +180,20 @@ def __init__( class AscOperation(msrest.serialization.Model): """The status of operation. - :param id: The operation Id. - :type id: str - :param name: The operation name. - :type name: str - :param start_time: The start time of the operation. - :type start_time: str - :param end_time: The end time of the operation. - :type end_time: str - :param status: The status of the operation. - :type status: str - :param error: The error detail of the operation if any. - :type error: ~storage_cache_management_client.models.ErrorResponse - :param output: Additional operation-specific output. - :type output: dict[str, any] + :ivar id: The operation Id. + :vartype id: str + :ivar name: The operation name. + :vartype name: str + :ivar start_time: The start time of the operation. + :vartype start_time: str + :ivar end_time: The end time of the operation. + :vartype end_time: str + :ivar status: The status of the operation. + :vartype status: str + :ivar error: The error detail of the operation if any. + :vartype error: ~storage_cache_management_client.models.ErrorResponse + :ivar output: Additional operation-specific output. + :vartype output: dict[str, any] """ _attribute_map = { @@ -182,6 +218,22 @@ def __init__( output: Optional[Dict[str, Any]] = None, **kwargs ): + """ + :keyword id: The operation Id. + :paramtype id: str + :keyword name: The operation name. + :paramtype name: str + :keyword start_time: The start time of the operation. + :paramtype start_time: str + :keyword end_time: The end time of the operation. + :paramtype end_time: str + :keyword status: The status of the operation. + :paramtype status: str + :keyword error: The error detail of the operation if any. + :paramtype error: ~storage_cache_management_client.models.ErrorResponse + :keyword output: Additional operation-specific output. + :paramtype output: dict[str, any] + """ super(AscOperation, self).__init__(**kwargs) self.id = id self.name = name @@ -195,10 +247,10 @@ def __init__( class BlobNfsTarget(msrest.serialization.Model): """Properties pertaining to the BlobNfsTarget. - :param target: Resource ID of the storage container. - :type target: str - :param usage_model: Identifies the StorageCache usage model to be used for this storage target. - :type usage_model: str + :ivar target: Resource ID of the storage container. + :vartype target: str + :ivar usage_model: Identifies the StorageCache usage model to be used for this storage target. + :vartype usage_model: str """ _attribute_map = { @@ -213,6 +265,13 @@ def __init__( usage_model: Optional[str] = None, **kwargs ): + """ + :keyword target: Resource ID of the storage container. + :paramtype target: str + :keyword usage_model: Identifies the StorageCache usage model to be used for this storage + target. + :paramtype usage_model: str + """ super(BlobNfsTarget, self).__init__(**kwargs) self.target = target self.usage_model = usage_model @@ -223,24 +282,24 @@ class Cache(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar id: Resource ID of the Cache. :vartype id: str - :param location: Region name string. - :type location: str + :ivar location: Region name string. + :vartype location: str :ivar name: Name of Cache. :vartype name: str :ivar type: Type of the Cache; Microsoft.StorageCache/Cache. :vartype type: str - :param identity: The identity of the cache, if configured. - :type identity: ~storage_cache_management_client.models.CacheIdentity + :ivar identity: The identity of the cache, if configured. + :vartype identity: ~storage_cache_management_client.models.CacheIdentity :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~storage_cache_management_client.models.SystemData - :param sku: SKU for the Cache. - :type sku: ~storage_cache_management_client.models.CacheSku - :param cache_size_gb: The size of this Cache, in GB. - :type cache_size_gb: int + :ivar sku: SKU for the Cache. + :vartype sku: ~storage_cache_management_client.models.CacheSku + :ivar cache_size_gb: The size of this Cache, in GB. + :vartype cache_size_gb: int :ivar health: Health of the Cache. :vartype health: ~storage_cache_management_client.models.CacheHealth :ivar mount_addresses: Array of IP addresses that can be used by clients mounting this Cache. @@ -251,18 +310,18 @@ class Cache(msrest.serialization.Model): "Updating". :vartype provisioning_state: str or ~storage_cache_management_client.models.ProvisioningStateType - :param subnet: Subnet used for the Cache. - :type subnet: str + :ivar subnet: Subnet used for the Cache. + :vartype subnet: str :ivar upgrade_status: Upgrade status of the Cache. :vartype upgrade_status: ~storage_cache_management_client.models.CacheUpgradeStatus - :param network_settings: Specifies network settings of the cache. - :type network_settings: ~storage_cache_management_client.models.CacheNetworkSettings - :param encryption_settings: Specifies encryption settings of the cache. - :type encryption_settings: ~storage_cache_management_client.models.CacheEncryptionSettings - :param security_settings: Specifies security settings of the cache. - :type security_settings: ~storage_cache_management_client.models.CacheSecuritySettings - :param directory_services_settings: Specifies Directory Services settings of the cache. - :type directory_services_settings: + :ivar network_settings: Specifies network settings of the cache. + :vartype network_settings: ~storage_cache_management_client.models.CacheNetworkSettings + :ivar encryption_settings: Specifies encryption settings of the cache. + :vartype encryption_settings: ~storage_cache_management_client.models.CacheEncryptionSettings + :ivar security_settings: Specifies security settings of the cache. + :vartype security_settings: ~storage_cache_management_client.models.CacheSecuritySettings + :ivar directory_services_settings: Specifies Directory Services settings of the cache. + :vartype directory_services_settings: ~storage_cache_management_client.models.CacheDirectorySettings """ @@ -313,6 +372,29 @@ def __init__( directory_services_settings: Optional["CacheDirectorySettings"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Region name string. + :paramtype location: str + :keyword identity: The identity of the cache, if configured. + :paramtype identity: ~storage_cache_management_client.models.CacheIdentity + :keyword sku: SKU for the Cache. + :paramtype sku: ~storage_cache_management_client.models.CacheSku + :keyword cache_size_gb: The size of this Cache, in GB. + :paramtype cache_size_gb: int + :keyword subnet: Subnet used for the Cache. + :paramtype subnet: str + :keyword network_settings: Specifies network settings of the cache. + :paramtype network_settings: ~storage_cache_management_client.models.CacheNetworkSettings + :keyword encryption_settings: Specifies encryption settings of the cache. + :paramtype encryption_settings: ~storage_cache_management_client.models.CacheEncryptionSettings + :keyword security_settings: Specifies security settings of the cache. + :paramtype security_settings: ~storage_cache_management_client.models.CacheSecuritySettings + :keyword directory_services_settings: Specifies Directory Services settings of the cache. + :paramtype directory_services_settings: + ~storage_cache_management_client.models.CacheDirectorySettings + """ super(Cache, self).__init__(**kwargs) self.tags = tags self.id = None @@ -341,26 +423,26 @@ class CacheActiveDirectorySettings(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param primary_dns_ip_address: Required. Primary DNS IP address used to resolve the Active + :ivar primary_dns_ip_address: Required. Primary DNS IP address used to resolve the Active Directory domain controller's fully qualified domain name. - :type primary_dns_ip_address: str - :param secondary_dns_ip_address: Secondary DNS IP address used to resolve the Active Directory + :vartype primary_dns_ip_address: str + :ivar secondary_dns_ip_address: Secondary DNS IP address used to resolve the Active Directory domain controller's fully qualified domain name. - :type secondary_dns_ip_address: str - :param domain_name: Required. The fully qualified domain name of the Active Directory domain + :vartype secondary_dns_ip_address: str + :ivar domain_name: Required. The fully qualified domain name of the Active Directory domain controller. - :type domain_name: str - :param domain_net_bios_name: Required. The Active Directory domain's NetBIOS name. - :type domain_net_bios_name: str - :param cache_net_bios_name: Required. The NetBIOS name to assign to the HPC Cache when it joins + :vartype domain_name: str + :ivar domain_net_bios_name: Required. The Active Directory domain's NetBIOS name. + :vartype domain_net_bios_name: str + :ivar cache_net_bios_name: Required. The NetBIOS name to assign to the HPC Cache when it joins the Active Directory domain as a server. Length must 1-15 characters from the class [-0-9a-zA-Z]. - :type cache_net_bios_name: str + :vartype cache_net_bios_name: str :ivar domain_joined: True if the HPC Cache is joined to the Active Directory domain. Possible values include: "Yes", "No", "Error". :vartype domain_joined: str or ~storage_cache_management_client.models.DomainJoinedType - :param credentials: Active Directory admin credentials used to join the HPC Cache to a domain. - :type credentials: + :ivar credentials: Active Directory admin credentials used to join the HPC Cache to a domain. + :vartype credentials: ~storage_cache_management_client.models.CacheActiveDirectorySettingsCredentials """ @@ -393,6 +475,27 @@ def __init__( credentials: Optional["CacheActiveDirectorySettingsCredentials"] = None, **kwargs ): + """ + :keyword primary_dns_ip_address: Required. Primary DNS IP address used to resolve the Active + Directory domain controller's fully qualified domain name. + :paramtype primary_dns_ip_address: str + :keyword secondary_dns_ip_address: Secondary DNS IP address used to resolve the Active + Directory domain controller's fully qualified domain name. + :paramtype secondary_dns_ip_address: str + :keyword domain_name: Required. The fully qualified domain name of the Active Directory domain + controller. + :paramtype domain_name: str + :keyword domain_net_bios_name: Required. The Active Directory domain's NetBIOS name. + :paramtype domain_net_bios_name: str + :keyword cache_net_bios_name: Required. The NetBIOS name to assign to the HPC Cache when it + joins the Active Directory domain as a server. Length must 1-15 characters from the class + [-0-9a-zA-Z]. + :paramtype cache_net_bios_name: str + :keyword credentials: Active Directory admin credentials used to join the HPC Cache to a + domain. + :paramtype credentials: + ~storage_cache_management_client.models.CacheActiveDirectorySettingsCredentials + """ super(CacheActiveDirectorySettings, self).__init__(**kwargs) self.primary_dns_ip_address = primary_dns_ip_address self.secondary_dns_ip_address = secondary_dns_ip_address @@ -408,12 +511,12 @@ class CacheActiveDirectorySettingsCredentials(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param username: Required. Username of the Active Directory domain administrator. This value is + :ivar username: Required. Username of the Active Directory domain administrator. This value is stored encrypted and not returned on response. - :type username: str - :param password: Required. Plain text password of the Active Directory domain administrator. + :vartype username: str + :ivar password: Required. Plain text password of the Active Directory domain administrator. This value is stored encrypted and not returned on response. - :type password: str + :vartype password: str """ _validation = { @@ -433,6 +536,14 @@ def __init__( password: str, **kwargs ): + """ + :keyword username: Required. Username of the Active Directory domain administrator. This value + is stored encrypted and not returned on response. + :paramtype username: str + :keyword password: Required. Plain text password of the Active Directory domain administrator. + This value is stored encrypted and not returned on response. + :paramtype password: str + """ super(CacheActiveDirectorySettingsCredentials, self).__init__(**kwargs) self.username = username self.password = password @@ -441,12 +552,13 @@ def __init__( class CacheDirectorySettings(msrest.serialization.Model): """Cache Directory Services settings. - :param active_directory: Specifies settings for joining the HPC Cache to an Active Directory + :ivar active_directory: Specifies settings for joining the HPC Cache to an Active Directory domain. - :type active_directory: ~storage_cache_management_client.models.CacheActiveDirectorySettings - :param username_download: Specifies settings for Extended Groups. Extended Groups allows users + :vartype active_directory: ~storage_cache_management_client.models.CacheActiveDirectorySettings + :ivar username_download: Specifies settings for Extended Groups. Extended Groups allows users to be members of more than 16 groups. - :type username_download: ~storage_cache_management_client.models.CacheUsernameDownloadSettings + :vartype username_download: + ~storage_cache_management_client.models.CacheUsernameDownloadSettings """ _attribute_map = { @@ -461,6 +573,16 @@ def __init__( username_download: Optional["CacheUsernameDownloadSettings"] = None, **kwargs ): + """ + :keyword active_directory: Specifies settings for joining the HPC Cache to an Active Directory + domain. + :paramtype active_directory: + ~storage_cache_management_client.models.CacheActiveDirectorySettings + :keyword username_download: Specifies settings for Extended Groups. Extended Groups allows + users to be members of more than 16 groups. + :paramtype username_download: + ~storage_cache_management_client.models.CacheUsernameDownloadSettings + """ super(CacheDirectorySettings, self).__init__(**kwargs) self.active_directory = active_directory self.username_download = username_download @@ -469,11 +591,11 @@ def __init__( class CacheEncryptionSettings(msrest.serialization.Model): """Cache encryption settings. - :param key_encryption_key: Specifies the location of the key encryption key in Key Vault. - :type key_encryption_key: ~storage_cache_management_client.models.KeyVaultKeyReference - :param rotation_to_latest_key_version_enabled: Specifies whether the service will automatically + :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :vartype key_encryption_key: ~storage_cache_management_client.models.KeyVaultKeyReference + :ivar rotation_to_latest_key_version_enabled: Specifies whether the service will automatically rotate to the newest version of the key in the Key Vault. - :type rotation_to_latest_key_version_enabled: bool + :vartype rotation_to_latest_key_version_enabled: bool """ _attribute_map = { @@ -488,6 +610,13 @@ def __init__( rotation_to_latest_key_version_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :paramtype key_encryption_key: ~storage_cache_management_client.models.KeyVaultKeyReference + :keyword rotation_to_latest_key_version_enabled: Specifies whether the service will + automatically rotate to the newest version of the key in the Key Vault. + :paramtype rotation_to_latest_key_version_enabled: bool + """ super(CacheEncryptionSettings, self).__init__(**kwargs) self.key_encryption_key = key_encryption_key self.rotation_to_latest_key_version_enabled = rotation_to_latest_key_version_enabled @@ -498,11 +627,11 @@ class CacheHealth(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param state: List of Cache health states. Possible values include: "Unknown", "Healthy", + :ivar state: List of Cache health states. Possible values include: "Unknown", "Healthy", "Degraded", "Down", "Transitioning", "Stopping", "Stopped", "Upgrading", "Flushing". - :type state: str or ~storage_cache_management_client.models.HealthStateType - :param status_description: Describes explanation of state. - :type status_description: str + :vartype state: str or ~storage_cache_management_client.models.HealthStateType + :ivar status_description: Describes explanation of state. + :vartype status_description: str :ivar conditions: Outstanding conditions that need to be investigated and resolved. :vartype conditions: list[~storage_cache_management_client.models.Condition] """ @@ -524,6 +653,13 @@ def __init__( status_description: Optional[str] = None, **kwargs ): + """ + :keyword state: List of Cache health states. Possible values include: "Unknown", "Healthy", + "Degraded", "Down", "Transitioning", "Stopping", "Stopped", "Upgrading", "Flushing". + :paramtype state: str or ~storage_cache_management_client.models.HealthStateType + :keyword status_description: Describes explanation of state. + :paramtype status_description: str + """ super(CacheHealth, self).__init__(**kwargs) self.state = state self.status_description = status_description @@ -539,12 +675,12 @@ class CacheIdentity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID associated with the cache. :vartype tenant_id: str - :param type: The type of identity used for the cache. Possible values include: - "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :type type: str or ~storage_cache_management_client.models.CacheIdentityType - :param user_assigned_identities: A dictionary where each key is a user assigned identity + :ivar type: The type of identity used for the cache. Possible values include: "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned", "None". + :vartype type: str or ~storage_cache_management_client.models.CacheIdentityType + :ivar user_assigned_identities: A dictionary where each key is a user assigned identity resource ID, and each key's value is an empty dictionary. - :type user_assigned_identities: dict[str, + :vartype user_assigned_identities: dict[str, ~storage_cache_management_client.models.UserAssignedIdentitiesValue] """ @@ -567,6 +703,15 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedIdentitiesValue"]] = None, **kwargs ): + """ + :keyword type: The type of identity used for the cache. Possible values include: + "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". + :paramtype type: str or ~storage_cache_management_client.models.CacheIdentityType + :keyword user_assigned_identities: A dictionary where each key is a user assigned identity + resource ID, and each key's value is an empty dictionary. + :paramtype user_assigned_identities: dict[str, + ~storage_cache_management_client.models.UserAssignedIdentitiesValue] + """ super(CacheIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -579,18 +724,18 @@ class CacheNetworkSettings(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param mtu: The IPv4 maximum transmission unit configured for the subnet. - :type mtu: int + :ivar mtu: The IPv4 maximum transmission unit configured for the subnet. + :vartype mtu: int :ivar utility_addresses: Array of additional IP addresses used by this Cache. :vartype utility_addresses: list[str] - :param dns_servers: DNS servers for the cache to use. It will be set from the network + :ivar dns_servers: DNS servers for the cache to use. It will be set from the network configuration if no value is provided. - :type dns_servers: list[str] - :param dns_search_domain: DNS search domain. - :type dns_search_domain: str - :param ntp_server: NTP server IP Address or FQDN for the cache to use. The default is + :vartype dns_servers: list[str] + :ivar dns_search_domain: DNS search domain. + :vartype dns_search_domain: str + :ivar ntp_server: NTP server IP Address or FQDN for the cache to use. The default is time.windows.com. - :type ntp_server: str + :vartype ntp_server: str """ _validation = { @@ -615,6 +760,18 @@ def __init__( ntp_server: Optional[str] = "time.windows.com", **kwargs ): + """ + :keyword mtu: The IPv4 maximum transmission unit configured for the subnet. + :paramtype mtu: int + :keyword dns_servers: DNS servers for the cache to use. It will be set from the network + configuration if no value is provided. + :paramtype dns_servers: list[str] + :keyword dns_search_domain: DNS search domain. + :paramtype dns_search_domain: str + :keyword ntp_server: NTP server IP Address or FQDN for the cache to use. The default is + time.windows.com. + :paramtype ntp_server: str + """ super(CacheNetworkSettings, self).__init__(**kwargs) self.mtu = mtu self.utility_addresses = None @@ -626,8 +783,8 @@ def __init__( class CacheSecuritySettings(msrest.serialization.Model): """Cache security settings. - :param access_policies: NFS access policies defined for this cache. - :type access_policies: list[~storage_cache_management_client.models.NfsAccessPolicy] + :ivar access_policies: NFS access policies defined for this cache. + :vartype access_policies: list[~storage_cache_management_client.models.NfsAccessPolicy] """ _attribute_map = { @@ -640,6 +797,10 @@ def __init__( access_policies: Optional[List["NfsAccessPolicy"]] = None, **kwargs ): + """ + :keyword access_policies: NFS access policies defined for this cache. + :paramtype access_policies: list[~storage_cache_management_client.models.NfsAccessPolicy] + """ super(CacheSecuritySettings, self).__init__(**kwargs) self.access_policies = access_policies @@ -647,8 +808,8 @@ def __init__( class CacheSku(msrest.serialization.Model): """SKU for the Cache. - :param name: SKU name for this Cache. - :type name: str + :ivar name: SKU name for this Cache. + :vartype name: str """ _attribute_map = { @@ -661,6 +822,10 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword name: SKU name for this Cache. + :paramtype name: str + """ super(CacheSku, self).__init__(**kwargs) self.name = name @@ -668,10 +833,10 @@ def __init__( class CachesListResult(msrest.serialization.Model): """Result of the request to list Caches. It contains a list of Caches and a URL link to get the next set of results. - :param next_link: URL to get the next set of Cache list results, if there are any. - :type next_link: str - :param value: List of Caches. - :type value: list[~storage_cache_management_client.models.Cache] + :ivar next_link: URL to get the next set of Cache list results, if there are any. + :vartype next_link: str + :ivar value: List of Caches. + :vartype value: list[~storage_cache_management_client.models.Cache] """ _attribute_map = { @@ -686,6 +851,12 @@ def __init__( value: Optional[List["Cache"]] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of Cache list results, if there are any. + :paramtype next_link: str + :keyword value: List of Caches. + :paramtype value: list[~storage_cache_management_client.models.Cache] + """ super(CachesListResult, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -735,6 +906,8 @@ def __init__( self, **kwargs ): + """ + """ super(CacheUpgradeStatus, self).__init__(**kwargs) self.current_firmware_version = None self.firmware_update_status = None @@ -748,38 +921,38 @@ class CacheUsernameDownloadSettings(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param extended_groups: Whether or not Extended Groups is enabled. - :type extended_groups: bool - :param username_source: This setting determines how the cache gets username and group names for + :ivar extended_groups: Whether or not Extended Groups is enabled. + :vartype extended_groups: bool + :ivar username_source: This setting determines how the cache gets username and group names for clients. Possible values include: "AD", "LDAP", "File", "None". Default value: "None". - :type username_source: str or ~storage_cache_management_client.models.UsernameSource - :param group_file_uri: The URI of the file containing group information (in /etc/group file + :vartype username_source: str or ~storage_cache_management_client.models.UsernameSource + :ivar group_file_uri: The URI of the file containing group information (in /etc/group file format). This field must be populated when 'usernameSource' is set to 'File'. - :type group_file_uri: str - :param user_file_uri: The URI of the file containing user information (in /etc/passwd file + :vartype group_file_uri: str + :ivar user_file_uri: The URI of the file containing user information (in /etc/passwd file format). This field must be populated when 'usernameSource' is set to 'File'. - :type user_file_uri: str - :param ldap_server: The fully qualified domain name or IP address of the LDAP server to use. - :type ldap_server: str - :param ldap_base_dn: The base distinguished name for the LDAP domain. - :type ldap_base_dn: str - :param encrypt_ldap_connection: Whether or not the LDAP connection should be encrypted. - :type encrypt_ldap_connection: bool - :param require_valid_certificate: Determines if the certificates must be validated by a + :vartype user_file_uri: str + :ivar ldap_server: The fully qualified domain name or IP address of the LDAP server to use. + :vartype ldap_server: str + :ivar ldap_base_dn: The base distinguished name for the LDAP domain. + :vartype ldap_base_dn: str + :ivar encrypt_ldap_connection: Whether or not the LDAP connection should be encrypted. + :vartype encrypt_ldap_connection: bool + :ivar require_valid_certificate: Determines if the certificates must be validated by a certificate authority. When true, caCertificateURI must be provided. - :type require_valid_certificate: bool - :param auto_download_certificate: Determines if the certificate should be automatically + :vartype require_valid_certificate: bool + :ivar auto_download_certificate: Determines if the certificate should be automatically downloaded. This applies to 'caCertificateURI' only if 'requireValidCertificate' is true. - :type auto_download_certificate: bool - :param ca_certificate_uri: The URI of the CA certificate to validate the LDAP secure - connection. This field must be populated when 'requireValidCertificate' is set to true. - :type ca_certificate_uri: str + :vartype auto_download_certificate: bool + :ivar ca_certificate_uri: The URI of the CA certificate to validate the LDAP secure connection. + This field must be populated when 'requireValidCertificate' is set to true. + :vartype ca_certificate_uri: str :ivar username_downloaded: Indicates whether or not the HPC Cache has performed the username download successfully. Possible values include: "Yes", "No", "Error". :vartype username_downloaded: str or ~storage_cache_management_client.models.UsernameDownloadedType - :param credentials: When present, these are the credentials for the secure LDAP connection. - :type credentials: + :ivar credentials: When present, these are the credentials for the secure LDAP connection. + :vartype credentials: ~storage_cache_management_client.models.CacheUsernameDownloadSettingsCredentials """ @@ -818,6 +991,37 @@ def __init__( credentials: Optional["CacheUsernameDownloadSettingsCredentials"] = None, **kwargs ): + """ + :keyword extended_groups: Whether or not Extended Groups is enabled. + :paramtype extended_groups: bool + :keyword username_source: This setting determines how the cache gets username and group names + for clients. Possible values include: "AD", "LDAP", "File", "None". Default value: "None". + :paramtype username_source: str or ~storage_cache_management_client.models.UsernameSource + :keyword group_file_uri: The URI of the file containing group information (in /etc/group file + format). This field must be populated when 'usernameSource' is set to 'File'. + :paramtype group_file_uri: str + :keyword user_file_uri: The URI of the file containing user information (in /etc/passwd file + format). This field must be populated when 'usernameSource' is set to 'File'. + :paramtype user_file_uri: str + :keyword ldap_server: The fully qualified domain name or IP address of the LDAP server to use. + :paramtype ldap_server: str + :keyword ldap_base_dn: The base distinguished name for the LDAP domain. + :paramtype ldap_base_dn: str + :keyword encrypt_ldap_connection: Whether or not the LDAP connection should be encrypted. + :paramtype encrypt_ldap_connection: bool + :keyword require_valid_certificate: Determines if the certificates must be validated by a + certificate authority. When true, caCertificateURI must be provided. + :paramtype require_valid_certificate: bool + :keyword auto_download_certificate: Determines if the certificate should be automatically + downloaded. This applies to 'caCertificateURI' only if 'requireValidCertificate' is true. + :paramtype auto_download_certificate: bool + :keyword ca_certificate_uri: The URI of the CA certificate to validate the LDAP secure + connection. This field must be populated when 'requireValidCertificate' is set to true. + :paramtype ca_certificate_uri: str + :keyword credentials: When present, these are the credentials for the secure LDAP connection. + :paramtype credentials: + ~storage_cache_management_client.models.CacheUsernameDownloadSettingsCredentials + """ super(CacheUsernameDownloadSettings, self).__init__(**kwargs) self.extended_groups = extended_groups self.username_source = username_source @@ -836,12 +1040,12 @@ def __init__( class CacheUsernameDownloadSettingsCredentials(msrest.serialization.Model): """When present, these are the credentials for the secure LDAP connection. - :param bind_dn: The Bind Distinguished Name identity to be used in the secure LDAP connection. + :ivar bind_dn: The Bind Distinguished Name identity to be used in the secure LDAP connection. This value is stored encrypted and not returned on response. - :type bind_dn: str - :param bind_password: The Bind password to be used in the secure LDAP connection. This value is + :vartype bind_dn: str + :ivar bind_password: The Bind password to be used in the secure LDAP connection. This value is stored encrypted and not returned on response. - :type bind_password: str + :vartype bind_password: str """ _attribute_map = { @@ -856,6 +1060,14 @@ def __init__( bind_password: Optional[str] = None, **kwargs ): + """ + :keyword bind_dn: The Bind Distinguished Name identity to be used in the secure LDAP + connection. This value is stored encrypted and not returned on response. + :paramtype bind_dn: str + :keyword bind_password: The Bind password to be used in the secure LDAP connection. This value + is stored encrypted and not returned on response. + :paramtype bind_password: str + """ super(CacheUsernameDownloadSettingsCredentials, self).__init__(**kwargs) self.bind_dn = bind_dn self.bind_password = bind_password @@ -864,8 +1076,8 @@ def __init__( class ClfsTarget(msrest.serialization.Model): """Properties pertaining to the ClfsTarget. - :param target: Resource ID of storage container. - :type target: str + :ivar target: Resource ID of storage container. + :vartype target: str """ _attribute_map = { @@ -878,6 +1090,10 @@ def __init__( target: Optional[str] = None, **kwargs ): + """ + :keyword target: Resource ID of storage container. + :paramtype target: str + """ super(ClfsTarget, self).__init__(**kwargs) self.target = target @@ -885,17 +1101,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param details: A list of additional details about the error. - :type details: list[~storage_cache_management_client.models.CloudErrorBody] - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar details: A list of additional details about the error. + :vartype details: list[~storage_cache_management_client.models.CloudErrorBody] + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str + :vartype target: str """ _attribute_map = { @@ -914,6 +1130,19 @@ def __init__( target: Optional[str] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~storage_cache_management_client.models.CloudErrorBody] + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.details = details @@ -946,6 +1175,8 @@ def __init__( self, **kwargs ): + """ + """ super(Condition, self).__init__(**kwargs) self.timestamp = None self.message = None @@ -954,10 +1185,10 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Describes the format of Error response. - :param code: Error code. - :type code: str - :param message: Error message indicating why the operation failed. - :type message: str + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str """ _attribute_map = { @@ -972,6 +1203,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: Error code. + :paramtype code: str + :keyword message: Error message indicating why the operation failed. + :paramtype message: str + """ super(ErrorResponse, self).__init__(**kwargs) self.code = code self.message = message @@ -982,10 +1219,10 @@ class KeyVaultKeyReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_url: Required. The URL referencing a key encryption key in Key Vault. - :type key_url: str - :param source_vault: Required. Describes a resource Id to source Key Vault. - :type source_vault: ~storage_cache_management_client.models.KeyVaultKeyReferenceSourceVault + :ivar key_url: Required. The URL referencing a key encryption key in Key Vault. + :vartype key_url: str + :ivar source_vault: Required. Describes a resource Id to source Key Vault. + :vartype source_vault: ~storage_cache_management_client.models.KeyVaultKeyReferenceSourceVault """ _validation = { @@ -1005,6 +1242,13 @@ def __init__( source_vault: "KeyVaultKeyReferenceSourceVault", **kwargs ): + """ + :keyword key_url: Required. The URL referencing a key encryption key in Key Vault. + :paramtype key_url: str + :keyword source_vault: Required. Describes a resource Id to source Key Vault. + :paramtype source_vault: + ~storage_cache_management_client.models.KeyVaultKeyReferenceSourceVault + """ super(KeyVaultKeyReference, self).__init__(**kwargs) self.key_url = key_url self.source_vault = source_vault @@ -1013,8 +1257,8 @@ def __init__( class KeyVaultKeyReferenceSourceVault(msrest.serialization.Model): """Describes a resource Id to source Key Vault. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -1027,6 +1271,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(KeyVaultKeyReferenceSourceVault, self).__init__(**kwargs) self.id = id @@ -1034,14 +1282,14 @@ def __init__( class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension. - :type name: str - :param display_name: Localized friendly display name of the dimension. - :type display_name: str - :param internal_name: Internal name of the dimension. - :type internal_name: str - :param to_be_exported_for_shoebox: To be exported to shoe box. - :type to_be_exported_for_shoebox: bool + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar internal_name: Internal name of the dimension. + :vartype internal_name: str + :ivar to_be_exported_for_shoebox: To be exported to shoe box. + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1060,6 +1308,16 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword internal_name: Internal name of the dimension. + :paramtype internal_name: str + :keyword to_be_exported_for_shoebox: To be exported to shoe box. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1070,23 +1328,23 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Details about operation related to metrics. - :param name: The name of the metric. - :type name: str - :param display_name: Localized display name of the metric. - :type display_name: str - :param display_description: The description of the metric. - :type display_description: str - :param unit: The unit that the metric is measured in. - :type unit: str - :param aggregation_type: The type of metric aggregation. - :type aggregation_type: str - :param supported_aggregation_types: Support metric aggregation type. - :type supported_aggregation_types: list[str or + :ivar name: The name of the metric. + :vartype name: str + :ivar display_name: Localized display name of the metric. + :vartype display_name: str + :ivar display_description: The description of the metric. + :vartype display_description: str + :ivar unit: The unit that the metric is measured in. + :vartype unit: str + :ivar aggregation_type: The type of metric aggregation. + :vartype aggregation_type: str + :ivar supported_aggregation_types: Support metric aggregation type. + :vartype supported_aggregation_types: list[str or ~storage_cache_management_client.models.MetricAggregationType] - :param metric_class: Type of metrics. - :type metric_class: str - :param dimensions: Dimensions of the metric. - :type dimensions: list[~storage_cache_management_client.models.MetricDimension] + :ivar metric_class: Type of metrics. + :vartype metric_class: str + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~storage_cache_management_client.models.MetricDimension] """ _attribute_map = { @@ -1113,6 +1371,25 @@ def __init__( dimensions: Optional[List["MetricDimension"]] = None, **kwargs ): + """ + :keyword name: The name of the metric. + :paramtype name: str + :keyword display_name: Localized display name of the metric. + :paramtype display_name: str + :keyword display_description: The description of the metric. + :paramtype display_description: str + :keyword unit: The unit that the metric is measured in. + :paramtype unit: str + :keyword aggregation_type: The type of metric aggregation. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Support metric aggregation type. + :paramtype supported_aggregation_types: list[str or + ~storage_cache_management_client.models.MetricAggregationType] + :keyword metric_class: Type of metrics. + :paramtype metric_class: str + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~storage_cache_management_client.models.MetricDimension] + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1127,14 +1404,14 @@ def __init__( class NamespaceJunction(msrest.serialization.Model): """A namespace junction. - :param namespace_path: Namespace path on a Cache for a Storage Target. - :type namespace_path: str - :param target_path: Path in Storage Target to which namespacePath points. - :type target_path: str - :param nfs_export: NFS export where targetPath exists. - :type nfs_export: str - :param nfs_access_policy: Name of the access policy applied to this junction. - :type nfs_access_policy: str + :ivar namespace_path: Namespace path on a Cache for a Storage Target. + :vartype namespace_path: str + :ivar target_path: Path in Storage Target to which namespacePath points. + :vartype target_path: str + :ivar nfs_export: NFS export where targetPath exists. + :vartype nfs_export: str + :ivar nfs_access_policy: Name of the access policy applied to this junction. + :vartype nfs_access_policy: str """ _attribute_map = { @@ -1153,6 +1430,16 @@ def __init__( nfs_access_policy: Optional[str] = "default", **kwargs ): + """ + :keyword namespace_path: Namespace path on a Cache for a Storage Target. + :paramtype namespace_path: str + :keyword target_path: Path in Storage Target to which namespacePath points. + :paramtype target_path: str + :keyword nfs_export: NFS export where targetPath exists. + :paramtype nfs_export: str + :keyword nfs_access_policy: Name of the access policy applied to this junction. + :paramtype nfs_access_policy: str + """ super(NamespaceJunction, self).__init__(**kwargs) self.namespace_path = namespace_path self.target_path = target_path @@ -1163,10 +1450,10 @@ def __init__( class Nfs3Target(msrest.serialization.Model): """Properties pertaining to the Nfs3Target. - :param target: IP address or host name of an NFSv3 host (e.g., 10.0.44.44). - :type target: str - :param usage_model: Identifies the StorageCache usage model to be used for this storage target. - :type usage_model: str + :ivar target: IP address or host name of an NFSv3 host (e.g., 10.0.44.44). + :vartype target: str + :ivar usage_model: Identifies the StorageCache usage model to be used for this storage target. + :vartype usage_model: str """ _validation = { @@ -1185,6 +1472,13 @@ def __init__( usage_model: Optional[str] = None, **kwargs ): + """ + :keyword target: IP address or host name of an NFSv3 host (e.g., 10.0.44.44). + :paramtype target: str + :keyword usage_model: Identifies the StorageCache usage model to be used for this storage + target. + :paramtype usage_model: str + """ super(Nfs3Target, self).__init__(**kwargs) self.target = target self.usage_model = usage_model @@ -1195,12 +1489,11 @@ class NfsAccessPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name identifying this policy. Access Policy names are not case - sensitive. - :type name: str - :param access_rules: Required. The set of rules describing client accesses allowed under this + :ivar name: Required. Name identifying this policy. Access Policy names are not case sensitive. + :vartype name: str + :ivar access_rules: Required. The set of rules describing client accesses allowed under this policy. - :type access_rules: list[~storage_cache_management_client.models.NfsAccessRule] + :vartype access_rules: list[~storage_cache_management_client.models.NfsAccessRule] """ _validation = { @@ -1220,6 +1513,14 @@ def __init__( access_rules: List["NfsAccessRule"], **kwargs ): + """ + :keyword name: Required. Name identifying this policy. Access Policy names are not case + sensitive. + :paramtype name: str + :keyword access_rules: Required. The set of rules describing client accesses allowed under this + policy. + :paramtype access_rules: list[~storage_cache_management_client.models.NfsAccessRule] + """ super(NfsAccessPolicy, self).__init__(**kwargs) self.name = name self.access_rules = access_rules @@ -1230,32 +1531,31 @@ class NfsAccessRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param scope: Required. Scope for this rule. The scope and filter determine which clients match + :ivar scope: Required. Scope for this rule. The scope and filter determine which clients match the rule. Possible values include: "default", "network", "host". - :type scope: str or ~storage_cache_management_client.models.NfsAccessRuleScope - :param filter: Filter applied to the scope for this rule. The filter's format depends on its + :vartype scope: str or ~storage_cache_management_client.models.NfsAccessRuleScope + :ivar filter: Filter applied to the scope for this rule. The filter's format depends on its scope. 'default' scope matches all clients and has no filter value. 'network' scope takes a filter in CIDR format (for example, 10.99.1.0/24). 'host' takes an IP address or fully qualified domain name as filter. If a client does not match any filter rule and there is no default rule, access is denied. - :type filter: str - :param access: Required. Access allowed by this rule. Possible values include: "no", "ro", - "rw". - :type access: str or ~storage_cache_management_client.models.NfsAccessRuleAccess - :param suid: Allow SUID semantics. - :type suid: bool - :param submount_access: For the default policy, allow access to subdirectories under the root + :vartype filter: str + :ivar access: Required. Access allowed by this rule. Possible values include: "no", "ro", "rw". + :vartype access: str or ~storage_cache_management_client.models.NfsAccessRuleAccess + :ivar suid: Allow SUID semantics. + :vartype suid: bool + :ivar submount_access: For the default policy, allow access to subdirectories under the root export. If this is set to no, clients can only mount the path '/'. If set to yes, clients can mount a deeper path, like '/a/b'. - :type submount_access: bool - :param root_squash: Map root accesses to anonymousUID and anonymousGID. - :type root_squash: bool - :param anonymous_uid: UID value that replaces 0 when rootSquash is true. 65534 will be used if + :vartype submount_access: bool + :ivar root_squash: Map root accesses to anonymousUID and anonymousGID. + :vartype root_squash: bool + :ivar anonymous_uid: UID value that replaces 0 when rootSquash is true. 65534 will be used if not provided. - :type anonymous_uid: str - :param anonymous_gid: GID value that replaces 0 when rootSquash is true. This will use the - value of anonymousUID if not provided. - :type anonymous_gid: str + :vartype anonymous_uid: str + :ivar anonymous_gid: GID value that replaces 0 when rootSquash is true. This will use the value + of anonymousUID if not provided. + :vartype anonymous_gid: str """ _validation = { @@ -1287,6 +1587,34 @@ def __init__( anonymous_gid: Optional[str] = None, **kwargs ): + """ + :keyword scope: Required. Scope for this rule. The scope and filter determine which clients + match the rule. Possible values include: "default", "network", "host". + :paramtype scope: str or ~storage_cache_management_client.models.NfsAccessRuleScope + :keyword filter: Filter applied to the scope for this rule. The filter's format depends on its + scope. 'default' scope matches all clients and has no filter value. 'network' scope takes a + filter in CIDR format (for example, 10.99.1.0/24). 'host' takes an IP address or fully + qualified domain name as filter. If a client does not match any filter rule and there is no + default rule, access is denied. + :paramtype filter: str + :keyword access: Required. Access allowed by this rule. Possible values include: "no", "ro", + "rw". + :paramtype access: str or ~storage_cache_management_client.models.NfsAccessRuleAccess + :keyword suid: Allow SUID semantics. + :paramtype suid: bool + :keyword submount_access: For the default policy, allow access to subdirectories under the root + export. If this is set to no, clients can only mount the path '/'. If set to yes, clients can + mount a deeper path, like '/a/b'. + :paramtype submount_access: bool + :keyword root_squash: Map root accesses to anonymousUID and anonymousGID. + :paramtype root_squash: bool + :keyword anonymous_uid: UID value that replaces 0 when rootSquash is true. 65534 will be used + if not provided. + :paramtype anonymous_uid: str + :keyword anonymous_gid: GID value that replaces 0 when rootSquash is true. This will use the + value of anonymousUID if not provided. + :paramtype anonymous_gid: str + """ super(NfsAccessRule, self).__init__(**kwargs) self.scope = scope self.filter = filter @@ -1305,18 +1633,18 @@ class ResourceSku(msrest.serialization.Model): :ivar resource_type: The type of resource the SKU applies to. :vartype resource_type: str - :param capabilities: A list of capabilities of this SKU, such as throughput or ops/sec. - :type capabilities: list[~storage_cache_management_client.models.ResourceSkuCapabilities] + :ivar capabilities: A list of capabilities of this SKU, such as throughput or ops/sec. + :vartype capabilities: list[~storage_cache_management_client.models.ResourceSkuCapabilities] :ivar locations: The set of locations where the SKU is available. This is the supported and registered Azure Geo Regions (e.g., West US, East US, Southeast Asia, etc.). :vartype locations: list[str] - :param location_info: The set of locations where the SKU is available. - :type location_info: list[~storage_cache_management_client.models.ResourceSkuLocationInfo] - :param name: The name of this SKU. - :type name: str - :param restrictions: The restrictions preventing this SKU from being used. This is empty if + :ivar location_info: The set of locations where the SKU is available. + :vartype location_info: list[~storage_cache_management_client.models.ResourceSkuLocationInfo] + :ivar name: The name of this SKU. + :vartype name: str + :ivar restrictions: The restrictions preventing this SKU from being used. This is empty if there are no restrictions. - :type restrictions: list[~storage_cache_management_client.models.Restriction] + :vartype restrictions: list[~storage_cache_management_client.models.Restriction] """ _validation = { @@ -1342,6 +1670,17 @@ def __init__( restrictions: Optional[List["Restriction"]] = None, **kwargs ): + """ + :keyword capabilities: A list of capabilities of this SKU, such as throughput or ops/sec. + :paramtype capabilities: list[~storage_cache_management_client.models.ResourceSkuCapabilities] + :keyword location_info: The set of locations where the SKU is available. + :paramtype location_info: list[~storage_cache_management_client.models.ResourceSkuLocationInfo] + :keyword name: The name of this SKU. + :paramtype name: str + :keyword restrictions: The restrictions preventing this SKU from being used. This is empty if + there are no restrictions. + :paramtype restrictions: list[~storage_cache_management_client.models.Restriction] + """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = None self.capabilities = capabilities @@ -1354,10 +1693,10 @@ def __init__( class ResourceSkuCapabilities(msrest.serialization.Model): """A resource SKU capability. - :param name: Name of a capability, such as ops/sec. - :type name: str - :param value: Quantity, if the capability is measured by quantity. - :type value: str + :ivar name: Name of a capability, such as ops/sec. + :vartype name: str + :ivar value: Quantity, if the capability is measured by quantity. + :vartype value: str """ _attribute_map = { @@ -1372,6 +1711,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of a capability, such as ops/sec. + :paramtype name: str + :keyword value: Quantity, if the capability is measured by quantity. + :paramtype value: str + """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = name self.value = value @@ -1380,10 +1725,10 @@ def __init__( class ResourceSkuLocationInfo(msrest.serialization.Model): """Resource SKU location information. - :param location: Location where this SKU is available. - :type location: str - :param zones: Zones if any. - :type zones: list[str] + :ivar location: Location where this SKU is available. + :vartype location: str + :ivar zones: Zones if any. + :vartype zones: list[str] """ _attribute_map = { @@ -1398,6 +1743,12 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): + """ + :keyword location: Location where this SKU is available. + :paramtype location: str + :keyword zones: Zones if any. + :paramtype zones: list[str] + """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = location self.zones = zones @@ -1408,8 +1759,8 @@ class ResourceSkusResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param next_link: The URI to fetch the next page of Cache SKUs. - :type next_link: str + :ivar next_link: The URI to fetch the next page of Cache SKUs. + :vartype next_link: str :ivar value: The list of SKUs available for the subscription. :vartype value: list[~storage_cache_management_client.models.ResourceSku] """ @@ -1429,6 +1780,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: The URI to fetch the next page of Cache SKUs. + :paramtype next_link: str + """ super(ResourceSkusResult, self).__init__(**kwargs) self.next_link = next_link self.value = None @@ -1445,11 +1800,11 @@ class Restriction(msrest.serialization.Model): :ivar values: The value of restrictions. If the restriction type is set to location, then this would be the different locations where the SKU is restricted. :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or + :ivar reason_code: The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". "QuotaId" is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. "NotAvailableForSubscription" is related to capacity at the datacenter. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~storage_cache_management_client.models.ReasonCode + :vartype reason_code: str or ~storage_cache_management_client.models.ReasonCode """ _validation = { @@ -1469,6 +1824,13 @@ def __init__( reason_code: Optional[Union[str, "ReasonCode"]] = None, **kwargs ): + """ + :keyword reason_code: The reason for the restriction. As of now this can be "QuotaId" or + "NotAvailableForSubscription". "QuotaId" is set when the SKU has requiredQuotas parameter as + the subscription does not belong to that quota. "NotAvailableForSubscription" is related to + capacity at the datacenter. Possible values include: "QuotaId", "NotAvailableForSubscription". + :paramtype reason_code: str or ~storage_cache_management_client.models.ReasonCode + """ super(Restriction, self).__init__(**kwargs) self.type = None self.values = None @@ -1512,6 +1874,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageTargetResource, self).__init__(**kwargs) self.name = None self.id = None @@ -1535,28 +1899,28 @@ class StorageTarget(StorageTargetResource): :vartype location: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~storage_cache_management_client.models.SystemData - :param junctions: List of Cache namespace junctions to target for namespace associations. - :type junctions: list[~storage_cache_management_client.models.NamespaceJunction] - :param target_type: Type of the Storage Target. Possible values include: "nfs3", "clfs", + :ivar junctions: List of Cache namespace junctions to target for namespace associations. + :vartype junctions: list[~storage_cache_management_client.models.NamespaceJunction] + :ivar target_type: Type of the Storage Target. Possible values include: "nfs3", "clfs", "unknown", "blobNfs". - :type target_type: str or ~storage_cache_management_client.models.StorageTargetType + :vartype target_type: str or ~storage_cache_management_client.models.StorageTargetType :ivar provisioning_state: ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. Possible values include: "Succeeded", "Failed", "Cancelled", "Creating", "Deleting", "Updating". :vartype provisioning_state: str or ~storage_cache_management_client.models.ProvisioningStateType - :param state: Storage target operational state. Possible values include: "Ready", "Busy", + :ivar state: Storage target operational state. Possible values include: "Ready", "Busy", "Suspended", "Flushing". - :type state: str or ~storage_cache_management_client.models.OperationalStateType - :param nfs3: Properties when targetType is nfs3. - :type nfs3: ~storage_cache_management_client.models.Nfs3Target - :param clfs: Properties when targetType is clfs. - :type clfs: ~storage_cache_management_client.models.ClfsTarget - :param unknown: Properties when targetType is unknown. - :type unknown: ~storage_cache_management_client.models.UnknownTarget - :param blob_nfs: Properties when targetType is blobNfs. - :type blob_nfs: ~storage_cache_management_client.models.BlobNfsTarget + :vartype state: str or ~storage_cache_management_client.models.OperationalStateType + :ivar nfs3: Properties when targetType is nfs3. + :vartype nfs3: ~storage_cache_management_client.models.Nfs3Target + :ivar clfs: Properties when targetType is clfs. + :vartype clfs: ~storage_cache_management_client.models.ClfsTarget + :ivar unknown: Properties when targetType is unknown. + :vartype unknown: ~storage_cache_management_client.models.UnknownTarget + :ivar blob_nfs: Properties when targetType is blobNfs. + :vartype blob_nfs: ~storage_cache_management_client.models.BlobNfsTarget """ _validation = { @@ -1596,6 +1960,24 @@ def __init__( blob_nfs: Optional["BlobNfsTarget"] = None, **kwargs ): + """ + :keyword junctions: List of Cache namespace junctions to target for namespace associations. + :paramtype junctions: list[~storage_cache_management_client.models.NamespaceJunction] + :keyword target_type: Type of the Storage Target. Possible values include: "nfs3", "clfs", + "unknown", "blobNfs". + :paramtype target_type: str or ~storage_cache_management_client.models.StorageTargetType + :keyword state: Storage target operational state. Possible values include: "Ready", "Busy", + "Suspended", "Flushing". + :paramtype state: str or ~storage_cache_management_client.models.OperationalStateType + :keyword nfs3: Properties when targetType is nfs3. + :paramtype nfs3: ~storage_cache_management_client.models.Nfs3Target + :keyword clfs: Properties when targetType is clfs. + :paramtype clfs: ~storage_cache_management_client.models.ClfsTarget + :keyword unknown: Properties when targetType is unknown. + :paramtype unknown: ~storage_cache_management_client.models.UnknownTarget + :keyword blob_nfs: Properties when targetType is blobNfs. + :paramtype blob_nfs: ~storage_cache_management_client.models.BlobNfsTarget + """ super(StorageTarget, self).__init__(**kwargs) self.junctions = junctions self.target_type = target_type @@ -1610,10 +1992,10 @@ def __init__( class StorageTargetsResult(msrest.serialization.Model): """A list of Storage Targets. - :param next_link: The URI to fetch the next page of Storage Targets. - :type next_link: str - :param value: The list of Storage Targets defined for the Cache. - :type value: list[~storage_cache_management_client.models.StorageTarget] + :ivar next_link: The URI to fetch the next page of Storage Targets. + :vartype next_link: str + :ivar value: The list of Storage Targets defined for the Cache. + :vartype value: list[~storage_cache_management_client.models.StorageTarget] """ _attribute_map = { @@ -1628,6 +2010,12 @@ def __init__( value: Optional[List["StorageTarget"]] = None, **kwargs ): + """ + :keyword next_link: The URI to fetch the next page of Storage Targets. + :paramtype next_link: str + :keyword value: The list of Storage Targets defined for the Cache. + :paramtype value: list[~storage_cache_management_client.models.StorageTarget] + """ super(StorageTargetsResult, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -1636,20 +2024,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~storage_cache_management_client.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :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 ~storage_cache_management_client.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". - :type last_modified_by_type: str or ~storage_cache_management_client.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~storage_cache_management_client.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -1672,6 +2060,22 @@ def __init__( 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 ~storage_cache_management_client.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 ~storage_cache_management_client.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 @@ -1684,9 +2088,9 @@ def __init__( class UnknownTarget(msrest.serialization.Model): """Properties pertaining to the UnknownTarget. - :param attributes: Dictionary of string->string pairs containing information about the Storage + :ivar attributes: Dictionary of string->string pairs containing information about the Storage Target. - :type attributes: dict[str, str] + :vartype attributes: dict[str, str] """ _attribute_map = { @@ -1699,6 +2103,11 @@ def __init__( attributes: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword attributes: Dictionary of string->string pairs containing information about the + Storage Target. + :paramtype attributes: dict[str, str] + """ super(UnknownTarget, self).__init__(**kwargs) self.attributes = attributes @@ -1706,13 +2115,13 @@ def __init__( class UsageModel(msrest.serialization.Model): """A usage model. - :param display: Localized information describing this usage model. - :type display: ~storage_cache_management_client.models.UsageModelDisplay - :param model_name: Non-localized keyword name for this usage model. - :type model_name: str - :param target_type: The type of Storage Target to which this model is applicable (only nfs3 as + :ivar display: Localized information describing this usage model. + :vartype display: ~storage_cache_management_client.models.UsageModelDisplay + :ivar model_name: Non-localized keyword name for this usage model. + :vartype model_name: str + :ivar target_type: The type of Storage Target to which this model is applicable (only nfs3 as of this version). - :type target_type: str + :vartype target_type: str """ _attribute_map = { @@ -1729,6 +2138,15 @@ def __init__( target_type: Optional[str] = None, **kwargs ): + """ + :keyword display: Localized information describing this usage model. + :paramtype display: ~storage_cache_management_client.models.UsageModelDisplay + :keyword model_name: Non-localized keyword name for this usage model. + :paramtype model_name: str + :keyword target_type: The type of Storage Target to which this model is applicable (only nfs3 + as of this version). + :paramtype target_type: str + """ super(UsageModel, self).__init__(**kwargs) self.display = display self.model_name = model_name @@ -1738,8 +2156,8 @@ def __init__( class UsageModelDisplay(msrest.serialization.Model): """Localized information describing this usage model. - :param description: String to display for this usage model. - :type description: str + :ivar description: String to display for this usage model. + :vartype description: str """ _attribute_map = { @@ -1752,6 +2170,10 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword description: String to display for this usage model. + :paramtype description: str + """ super(UsageModelDisplay, self).__init__(**kwargs) self.description = description @@ -1759,10 +2181,10 @@ def __init__( class UsageModelsResult(msrest.serialization.Model): """A list of Cache usage models. - :param next_link: The URI to fetch the next page of Cache usage models. - :type next_link: str - :param value: The list of usage models available for the subscription. - :type value: list[~storage_cache_management_client.models.UsageModel] + :ivar next_link: The URI to fetch the next page of Cache usage models. + :vartype next_link: str + :ivar value: The list of usage models available for the subscription. + :vartype value: list[~storage_cache_management_client.models.UsageModel] """ _attribute_map = { @@ -1777,6 +2199,12 @@ def __init__( value: Optional[List["UsageModel"]] = None, **kwargs ): + """ + :keyword next_link: The URI to fetch the next page of Cache usage models. + :paramtype next_link: str + :keyword value: The list of usage models available for the subscription. + :paramtype value: list[~storage_cache_management_client.models.UsageModel] + """ super(UsageModelsResult, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -1807,6 +2235,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/models/_storage_cache_management_client_enums.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/models/_storage_cache_management_client_enums.py index 5ac4021707e28..da3ba535a618c 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/models/_storage_cache_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/models/_storage_cache_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class CacheIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CacheIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity used for the cache """ @@ -35,7 +20,7 @@ class CacheIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -44,7 +29,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DomainJoinedType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DomainJoinedType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """True if the HPC Cache is joined to the Active Directory domain. """ @@ -52,7 +37,7 @@ class DomainJoinedType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NO = "No" ERROR = "Error" -class FirmwareStatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FirmwareStatusType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """True if there is a firmware update ready to install on this Cache. The firmware will automatically be installed after firmwareUpdateDeadline if not triggered earlier via the upgrade operation. @@ -61,7 +46,7 @@ class FirmwareStatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AVAILABLE = "available" UNAVAILABLE = "unavailable" -class HealthStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HealthStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """List of Cache health states. """ @@ -75,7 +60,7 @@ class HealthStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPGRADING = "Upgrading" FLUSHING = "Flushing" -class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricAggregationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NOT_SPECIFIED = "NotSpecified" NONE = "None" @@ -85,7 +70,7 @@ class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) TOTAL = "Total" COUNT = "Count" -class NfsAccessRuleAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NfsAccessRuleAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Access allowed by this rule. """ @@ -93,7 +78,7 @@ class NfsAccessRuleAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RO = "ro" RW = "rw" -class NfsAccessRuleScope(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NfsAccessRuleScope(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Scope for this rule. The scope and filter determine which clients match the rule. """ @@ -101,7 +86,7 @@ class NfsAccessRuleScope(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NETWORK = "network" HOST = "host" -class OperationalStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperationalStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Storage target operational state. """ @@ -110,7 +95,7 @@ class OperationalStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUSPENDED = "Suspended" FLUSHING = "Flushing" -class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property """ @@ -122,7 +107,7 @@ class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) DELETING = "Deleting" UPDATING = "Updating" -class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". "QuotaId" is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. "NotAvailableForSubscription" is related to @@ -132,7 +117,7 @@ class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class StorageTargetType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageTargetType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the Storage Target. """ @@ -141,7 +126,7 @@ class StorageTargetType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UNKNOWN = "unknown" BLOB_NFS = "blobNfs" -class UsernameDownloadedType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UsernameDownloadedType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates whether or not the HPC Cache has performed the username download successfully. """ @@ -149,7 +134,7 @@ class UsernameDownloadedType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) NO = "No" ERROR = "Error" -class UsernameSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UsernameSource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This setting determines how the cache gets username and group names for clients. """ diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_asc_operations_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_asc_operations_operations.py index b8409f97c5967..7a4b826f20490 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_asc_operations_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_asc_operations_operations.py @@ -5,23 +5,67 @@ # 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 TYPE_CHECKING 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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + location, # type: str + operation_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/ascOperations/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, '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 + ) + +# fmt: on class AscOperationsOperations(object): """AscOperationsOperations operations. @@ -44,6 +88,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, location, # type: str @@ -67,27 +112,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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'), - 'location': self._serialize.url("location", location, '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, + location=location, + 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 @@ -101,4 +136,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/ascOperations/{operationId}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_caches_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_caches_operations.py index 82db0b3210c8e..cb431235d974e 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_caches_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_caches_operations.py @@ -5,26 +5,432 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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_delete_request_initial( + resource_group_name, # type: str + cache_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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_get_request( + resource_group_name, # type: str + cache_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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_or_update_request_initial( + resource_group_name, # type: str + subscription_id, # type: str + cache_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + } + + 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + subscription_id, # type: str + cache_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + } + + 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, + **kwargs + ) + + +def build_debug_info_request_initial( + resource_group_name, # type: str + subscription_id, # type: str + cache_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + } + + 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_flush_request_initial( + resource_group_name, # type: str + subscription_id, # type: str + cache_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + } + + 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_start_request_initial( + resource_group_name, # type: str + subscription_id, # type: str + cache_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + } + + 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_stop_request_initial( + resource_group_name, # type: str + subscription_id, # type: str + cache_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + } + + 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_upgrade_firmware_request_initial( + resource_group_name, # type: str + subscription_id, # type: str + cache_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + } + + 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 + ) + +# fmt: on class CachesOperations(object): """CachesOperations operations. @@ -47,6 +453,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -64,34 +471,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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 - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + 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('CachesListResult', pipeline_response) + deserialized = self._deserialize("CachesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,11 +511,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name, # type: str @@ -134,35 +538,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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( + resource_group_name=resource_group_name, + 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('CachesListResult', pipeline_response) + deserialized = self._deserialize("CachesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -180,6 +580,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -197,27 +598,17 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # 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, + cache_name=cache_name, + subscription_id=self._config.subscription_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 @@ -230,6 +621,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -246,15 +639,17 @@ def begin_delete( :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -268,21 +663,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'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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: @@ -294,8 +682,10 @@ 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.StorageCache/caches/{cacheName}'} # type: ignore + @distributed_trace def get( self, resource_group_name, # type: str @@ -320,27 +710,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # 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, + cache_name=cache_name, + subscription_id=self._config.subscription_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 @@ -354,8 +734,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + def _create_or_update_initial( self, resource_group_name, # type: str @@ -369,35 +751,25 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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') - - body_content_kwargs = {} # type: Dict[str, Any] if cache is not None: - body_content = self._serialize.body(cache, 'Cache') + _json = self._serialize.body(cache, 'Cache') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -416,8 +788,11 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -438,15 +813,18 @@ def begin_create_or_update( :type cache: ~storage_cache_management_client.models.Cache :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Cache or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~storage_cache_management_client.models.Cache] - :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.Cache"] lro_delay = kwargs.pop( 'polling_interval', @@ -458,27 +836,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, cache_name=cache_name, cache=cache, + 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('Cache', 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -490,8 +862,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + @distributed_trace def update( self, resource_group_name, # type: str @@ -520,35 +894,25 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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') - - body_content_kwargs = {} # type: Dict[str, Any] if cache is not None: - body_content = self._serialize.body(cache, 'Cache') + _json = self._serialize.body(cache, 'Cache') 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + content_type=content_type, + json=_json, + template_url=self.update.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 @@ -562,8 +926,10 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + def _debug_info_initial( self, resource_group_name, # type: str @@ -576,27 +942,17 @@ def _debug_info_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._debug_info_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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_debug_info_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + template_url=self._debug_info_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -609,6 +965,8 @@ def _debug_info_initial( _debug_info_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo'} # type: ignore + + @distributed_trace def begin_debug_info( self, resource_group_name, # type: str @@ -625,15 +983,17 @@ def begin_debug_info( :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -647,21 +1007,14 @@ def begin_debug_info( 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -673,6 +1026,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_debug_info.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo'} # type: ignore def _flush_initial( @@ -687,27 +1041,17 @@ def _flush_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._flush_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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_flush_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + template_url=self._flush_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -720,6 +1064,8 @@ def _flush_initial( _flush_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush'} # type: ignore + + @distributed_trace def begin_flush( self, resource_group_name, # type: str @@ -737,15 +1083,17 @@ def begin_flush( :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -759,21 +1107,14 @@ def begin_flush( 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -785,6 +1126,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_flush.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush'} # type: ignore def _start_initial( @@ -799,27 +1141,17 @@ def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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_start_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -832,6 +1164,8 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start'} # type: ignore + + @distributed_trace def begin_start( self, resource_group_name, # type: str @@ -848,15 +1182,17 @@ def begin_start( :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -870,21 +1206,14 @@ def begin_start( 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -896,6 +1225,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start'} # type: ignore def _stop_initial( @@ -910,27 +1240,17 @@ def _stop_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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_stop_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -943,6 +1263,8 @@ def _stop_initial( _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop'} # type: ignore + + @distributed_trace def begin_stop( self, resource_group_name, # type: str @@ -959,15 +1281,17 @@ def begin_stop( :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -981,21 +1305,14 @@ def begin_stop( 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1007,6 +1324,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop'} # type: ignore def _upgrade_firmware_initial( @@ -1021,27 +1339,17 @@ def _upgrade_firmware_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._upgrade_firmware_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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_upgrade_firmware_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + template_url=self._upgrade_firmware_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1054,6 +1362,8 @@ def _upgrade_firmware_initial( _upgrade_firmware_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade'} # type: ignore + + @distributed_trace def begin_upgrade_firmware( self, resource_group_name, # type: str @@ -1071,15 +1381,17 @@ def begin_upgrade_firmware( :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1093,21 +1405,14 @@ def begin_upgrade_firmware( 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1119,4 +1424,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_upgrade_firmware.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_operations.py index fc9b3e826608c..b797f14740da6 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_operations.py @@ -5,24 +5,58 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.StorageCache/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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +88,10 @@ def list( """Lists all of the available Resource Provider operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiOperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~storage_cache_management_client.models.ApiOperationListResult] + :return: An iterator like instance of either ApiOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~storage_cache_management_client.models.ApiOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiOperationListResult"] @@ -62,30 +99,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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('ApiOperationListResult', pipeline_response) + deserialized = self._deserialize("ApiOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +137,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_skus_operations.py index 32ec238ca5a26..1c32d188d3673 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_skus_operations.py @@ -5,24 +5,64 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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 + ) + +# fmt: on class SkusOperations(object): """SkusOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +95,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceSkusResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~storage_cache_management_client.models.ResourceSkusResult] + :rtype: + ~azure.core.paging.ItemPaged[~storage_cache_management_client.models.ResourceSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkusResult"] @@ -62,34 +104,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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 - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + 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('ResourceSkusResult', pipeline_response) + deserialized = self._deserialize("ResourceSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +144,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_target_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_target_operations.py index f692a9f7a6102..e1a60cf621cec 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_target_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_target_operations.py @@ -5,25 +5,147 @@ # 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 TYPE_CHECKING 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.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 +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_flush_request_initial( + resource_group_name, # type: str + subscription_id, # type: str + cache_name, # type: str + storage_target_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/flush') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + "storageTargetName": _SERIALIZER.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + } + + 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_suspend_request_initial( + resource_group_name, # type: str + subscription_id, # type: str + cache_name, # type: str + storage_target_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/suspend') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + "storageTargetName": _SERIALIZER.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + } + + 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_resume_request_initial( + resource_group_name, # type: str + subscription_id, # type: str + cache_name, # type: str + storage_target_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/resume') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + "storageTargetName": _SERIALIZER.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + } + + 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 + ) + +# fmt: on class StorageTargetOperations(object): """StorageTargetOperations operations. @@ -59,28 +181,18 @@ def _flush_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._flush_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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_flush_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + storage_target_name=storage_target_name, + template_url=self._flush_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -93,6 +205,8 @@ def _flush_initial( _flush_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/flush'} # type: ignore + + @distributed_trace def begin_flush( self, resource_group_name, # type: str @@ -114,15 +228,17 @@ def begin_flush( :type storage_target_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -137,22 +253,14 @@ def begin_flush( 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -164,6 +272,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_flush.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/flush'} # type: ignore def _suspend_initial( @@ -179,28 +288,18 @@ def _suspend_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._suspend_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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_suspend_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + storage_target_name=storage_target_name, + template_url=self._suspend_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -213,6 +312,8 @@ def _suspend_initial( _suspend_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/suspend'} # type: ignore + + @distributed_trace def begin_suspend( self, resource_group_name, # type: str @@ -232,15 +333,17 @@ def begin_suspend( :type storage_target_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -255,22 +358,14 @@ def begin_suspend( 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -282,6 +377,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_suspend.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/suspend'} # type: ignore def _resume_initial( @@ -297,28 +393,18 @@ def _resume_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._resume_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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_resume_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + storage_target_name=storage_target_name, + template_url=self._resume_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -331,6 +417,8 @@ def _resume_initial( _resume_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/resume'} # type: ignore + + @distributed_trace def begin_resume( self, resource_group_name, # type: str @@ -350,15 +438,17 @@ def begin_resume( :type storage_target_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -373,22 +463,14 @@ def begin_resume( 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -400,4 +482,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_resume.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/resume'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_targets_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_targets_operations.py index 54acd6315762f..4bf81d9cf08fd 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_targets_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_targets_operations.py @@ -5,26 +5,230 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_dns_refresh_request_initial( + resource_group_name, # type: str + subscription_id, # type: str + cache_name, # type: str + storage_target_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + "storageTargetName": _SERIALIZER.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_cache_request( + resource_group_name, # type: str + subscription_id, # type: str + cache_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + } + + 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( + resource_group_name, # type: str + subscription_id, # type: str + cache_name, # type: str + storage_target_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + force = kwargs.pop('force', None) # type: Optional[str] + + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + "storageTargetName": _SERIALIZER.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + } + + 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') + if force is not None: + query_parameters['force'] = _SERIALIZER.query("force", force, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + subscription_id, # type: str + cache_name, # type: str + storage_target_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + "storageTargetName": _SERIALIZER.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name, # type: str + subscription_id, # type: str + cache_name, # type: str + storage_target_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + "storageTargetName": _SERIALIZER.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + } + + 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, + **kwargs + ) + +# fmt: on class StorageTargetsOperations(object): """StorageTargetsOperations operations. @@ -60,28 +264,18 @@ def _dns_refresh_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._dns_refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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_dns_refresh_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + storage_target_name=storage_target_name, + template_url=self._dns_refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -94,6 +288,8 @@ def _dns_refresh_initial( _dns_refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh'} # type: ignore + + @distributed_trace def begin_dns_refresh( self, resource_group_name, # type: str @@ -113,15 +309,17 @@ def begin_dns_refresh( :type storage_target_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -136,22 +334,14 @@ def begin_dns_refresh( 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -163,8 +353,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_dns_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh'} # type: ignore + @distributed_trace def list_by_cache( self, resource_group_name, # type: str @@ -180,8 +372,10 @@ def list_by_cache( from the [-0-9a-zA-Z_] char class. :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageTargetsResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~storage_cache_management_client.models.StorageTargetsResult] + :return: An iterator like instance of either StorageTargetsResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~storage_cache_management_client.models.StorageTargetsResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageTargetsResult"] @@ -189,36 +383,33 @@ def list_by_cache( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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_cache.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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_cache_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + template_url=self.list_by_cache.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_cache_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_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('StorageTargetsResult', pipeline_response) + deserialized = self._deserialize("StorageTargetsResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -236,6 +427,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -255,30 +447,19 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force is not None: - query_parameters['force'] = self._serialize.query("force", force, '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, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + storage_target_name=storage_target_name, + force=force, + 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 @@ -291,6 +472,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -317,15 +500,17 @@ def begin_delete( :type force: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -341,22 +526,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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - 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: @@ -368,8 +545,10 @@ 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.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'} # type: ignore + @distributed_trace def get( self, resource_group_name, # type: str @@ -397,28 +576,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + storage_target_name=storage_target_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 @@ -432,8 +601,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'} # type: ignore + def _create_or_update_initial( self, resource_group_name, # type: str @@ -448,36 +619,26 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - url = self._client.format_url(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') - - body_content_kwargs = {} # type: Dict[str, Any] if storagetarget is not None: - body_content = self._serialize.body(storagetarget, 'StorageTarget') + _json = self._serialize.body(storagetarget, 'StorageTarget') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + storage_target_name=storage_target_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -496,8 +657,11 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -522,15 +686,19 @@ def begin_create_or_update( :type storagetarget: ~storage_cache_management_client.models.StorageTarget :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either StorageTarget 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 StorageTarget or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~storage_cache_management_client.models.StorageTarget] - :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.StorageTarget"] lro_delay = kwargs.pop( 'polling_interval', @@ -543,28 +711,21 @@ def begin_create_or_update( cache_name=cache_name, storage_target_name=storage_target_name, storagetarget=storagetarget, + 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('StorageTarget', 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'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - 'storageTargetName': self._serialize.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), - } - 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: @@ -576,4 +737,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_usage_models_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_usage_models_operations.py index f2665a0cf947a..bcb103c5fd59f 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_usage_models_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_usage_models_operations.py @@ -5,24 +5,64 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/usageModels') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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 + ) + +# fmt: on class UsageModelsOperations(object): """UsageModelsOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -62,34 +103,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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 - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + 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('UsageModelsResult', pipeline_response) + deserialized = self._deserialize("UsageModelsResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storageimportexport/_meta.json b/sdk/storage/azure-mgmt-storageimportexport/_meta.json index d445615149a5d..3f6a49ddc7c15 100644 --- a/sdk/storage/azure-mgmt-storageimportexport/_meta.json +++ b/sdk/storage/azure-mgmt-storageimportexport/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.2", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.0", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "f802623b3e0ea71025e0c04d0478a0258aa3441d", + "commit": "2ab4371edba33c23e8d680ed2bf6f98705b5cadb", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/storageimportexport/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.0 --use=@autorest/modelerfour@4.19.2 --version=3.4.2", + "autorest_command": "autorest specification/storageimportexport/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.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/storageimportexport/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/__init__.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/__init__.py index 3573ec61388d1..fe65f75b70761 100644 --- a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/__init__.py +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['StorageImportExport'] -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-storageimportexport/azure/mgmt/storageimportexport/_configuration.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_configuration.py index bc668f91b24f4..25a68341e8e54 100644 --- a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_configuration.py +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -43,11 +43,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None + super(StorageImportExportConfiguration, 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(StorageImportExportConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -72,4 +72,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-storageimportexport/azure/mgmt/storageimportexport/_metadata.json b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_metadata.json index 42053ef5ac93e..bf6e5b800d4ff 100644 --- a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_metadata.json +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_metadata.json @@ -5,13 +5,13 @@ "name": "StorageImportExport", "filename": "_storage_import_export", "description": "The Storage Import/Export Resource Provider 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": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageImportExportConfiguration\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageImportExportConfiguration\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageImportExportConfiguration\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageImportExportConfiguration\"]}}}" }, "global_parameters": { "sync": { @@ -66,7 +66,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 @@ -86,7 +86,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 @@ -103,11 +103,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\", \"Optional\"]}}, \"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\", \"Optional\"]}}, \"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\", \"Optional\"]}}, \"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\", \"Optional\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "locations": "LocationsOperations", diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_patch.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_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-storageimportexport/azure/mgmt/storageimportexport/_storage_import_export.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_storage_import_export.py index d05fda135d1f0..f90d06803c5b0 100644 --- a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_storage_import_export.py +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_storage_import_export.py @@ -6,25 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import StorageImportExportConfiguration +from .operations import BitLockerKeysOperations, JobsOperations, LocationsOperations, Operations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Optional from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import StorageImportExportConfiguration -from .operations import LocationsOperations -from .operations import JobsOperations -from .operations import BitLockerKeysOperations -from .operations import Operations -from . import models - + from azure.core.rest import HttpRequest, HttpResponse class StorageImportExport(object): """The Storage Import/Export Resource Provider API. @@ -43,7 +40,8 @@ class StorageImportExport(object): :type subscription_id: str :param accept_language: Specifies the preferred language for the response. :type accept_language: str - :param str base_url: Service URL + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str """ def __init__( @@ -51,46 +49,49 @@ def __init__( credential, # type: "TokenCredential" subscription_id, # type: str accept_language=None, # type: Optional[str] - base_url=None, # type: Optional[str] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageImportExportConfiguration(credential, subscription_id, accept_language, **kwargs) + self._config = StorageImportExportConfiguration(credential=credential, subscription_id=subscription_id, accept_language=accept_language, **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.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bit_locker_keys = BitLockerKeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + - self.locations = LocationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bit_locker_keys = BitLockerKeysOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> HttpResponse """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_vendor.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_vendor.py new file mode 100644 index 0000000000000..138f663c53a4e --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_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-storageimportexport/azure/mgmt/storageimportexport/aio/__init__.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/__init__.py index 9dacfa50491ba..48b69ede79cd7 100644 --- a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/__init__.py @@ -8,3 +8,8 @@ from ._storage_import_export import StorageImportExport __all__ = ['StorageImportExport'] + +# `._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-storageimportexport/azure/mgmt/storageimportexport/aio/_configuration.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/_configuration.py index 6790d64ebbcca..88e9dc3cd48a6 100644 --- a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/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 @@ -40,11 +40,11 @@ def __init__( accept_language: Optional[str] = None, **kwargs: Any ) -> None: + super(StorageImportExportConfiguration, 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(StorageImportExportConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +68,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-storageimportexport/azure/mgmt/storageimportexport/aio/_patch.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/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-storageimportexport/azure/mgmt/storageimportexport/aio/_storage_import_export.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/_storage_import_export.py index d896a7bdb7572..02f697c4d332e 100644 --- a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/_storage_import_export.py +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/_storage_import_export.py @@ -6,25 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import StorageImportExportConfiguration +from .operations import BitLockerKeysOperations, JobsOperations, LocationsOperations, Operations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import StorageImportExportConfiguration -from .operations import LocationsOperations -from .operations import JobsOperations -from .operations import BitLockerKeysOperations -from .operations import Operations -from .. import models - - -class StorageImportExport(object): +class StorageImportExport: """The Storage Import/Export Resource Provider API. :ivar locations: LocationsOperations operations @@ -41,7 +38,8 @@ class StorageImportExport(object): :type subscription_id: str :param accept_language: Specifies the preferred language for the response. :type accept_language: str - :param str base_url: Service URL + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str """ def __init__( @@ -49,44 +47,47 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, accept_language: Optional[str] = None, - 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 = StorageImportExportConfiguration(credential, subscription_id, accept_language, **kwargs) + self._config = StorageImportExportConfiguration(credential=credential, subscription_id=subscription_id, accept_language=accept_language, **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.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bit_locker_keys = BitLockerKeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.locations = LocationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bit_locker_keys = BitLockerKeysOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/operations/_bit_locker_keys_operations.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/operations/_bit_locker_keys_operations.py index 19a5fdbcd826a..6dfd0ac24188c 100644 --- a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/operations/_bit_locker_keys_operations.py +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/operations/_bit_locker_keys_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._bit_locker_keys_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, job_name: str, @@ -55,8 +61,10 @@ def list( within the user subscription. :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 GetBitLockerKeysResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~storage_import_export.models.GetBitLockerKeysResponse] + :return: An iterator like instance of either GetBitLockerKeysResponse or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~storage_import_export.models.GetBitLockerKeysResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GetBitLockerKeysResponse"] @@ -64,38 +72,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.accept_language is not None: - header_parameters['Accept-Language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'jobName': self._serialize.url("job_name", job_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_request( + job_name=job_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + accept_language=self._config.accept_language, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + job_name=job_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + accept_language=self._config.accept_language, + 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('GetBitLockerKeysResponse', pipeline_response) + deserialized = self._deserialize("GetBitLockerKeysResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,12 +113,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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-storageimportexport/azure/mgmt/storageimportexport/aio/operations/_jobs_operations.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/operations/_jobs_operations.py index 48cfa73548986..c46b3ba81b359 100644 --- a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/operations/_jobs_operations.py +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/operations/_jobs_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._jobs_operations import build_create_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, top: Optional[int] = None, @@ -64,40 +70,35 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.accept_language is not None: - header_parameters['Accept-Language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'long') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + filter=filter, + accept_language=self._config.accept_language, + 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, + top=top, + filter=filter, + accept_language=self._config.accept_language, + 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('ListJobsResponse', pipeline_response) + deserialized = self._deserialize("ListJobsResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,17 +111,19 @@ 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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ImportExport/jobs'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -148,41 +151,37 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.accept_language is not None: - header_parameters['Accept-Language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'long') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + top=top, + filter=filter, + accept_language=self._config.accept_language, + 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, + top=top, + filter=filter, + accept_language=self._config.accept_language, + 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('ListJobsResponse', pipeline_response) + deserialized = self._deserialize("ListJobsResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -195,17 +194,19 @@ 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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.ImportExport/jobs'} # type: ignore + @distributed_trace_async async def get( self, job_name: str, @@ -229,35 +230,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'jobName': self._serialize.url("job_name", job_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.accept_language is not None: - header_parameters['Accept-Language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + job_name=job_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + accept_language=self._config.accept_language, + 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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -266,8 +256,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'} # type: ignore + + @distributed_trace_async async def update( self, job_name: str, @@ -296,40 +289,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'jobName': self._serialize.url("job_name", job_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.accept_language is not None: - header_parameters['Accept-Language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'UpdateJobParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'UpdateJobParameters') + + request = build_update_request( + job_name=job_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + accept_language=self._config.accept_language, + template_url=self.update.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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -338,8 +320,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'} # type: ignore + + @distributed_trace_async async def create( self, job_name: str, @@ -369,42 +354,30 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'jobName': self._serialize.url("job_name", job_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.accept_language is not None: - header_parameters['Accept-Language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') - if client_tenant_id is not None: - header_parameters['x-ms-client-tenant-id'] = self._serialize.header("client_tenant_id", client_tenant_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'PutJobParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'PutJobParameters') + + request = build_create_request( + job_name=job_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + accept_language=self._config.accept_language, + client_tenant_id=client_tenant_id, + template_url=self.create.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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -417,8 +390,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'} # type: ignore + + @distributed_trace_async async def delete( self, job_name: str, @@ -442,38 +418,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'jobName': self._serialize.url("job_name", job_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.accept_language is not None: - header_parameters['Accept-Language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + job_name=job_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + accept_language=self._config.accept_language, + 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/operations/_locations_operations.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/operations/_locations_operations.py index 8ed3f9813cead..259d810e62ca7 100644 --- a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/operations/_locations_operations.py +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/operations/_locations_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._locations_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -50,7 +56,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LocationsResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~storage_import_export.models.LocationsResponse] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~storage_import_export.models.LocationsResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.LocationsResponse"] @@ -58,32 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.accept_language is not None: - header_parameters['Accept-Language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') - 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( + accept_language=self._config.accept_language, + 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( + accept_language=self._config.accept_language, + 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('LocationsResponse', pipeline_response) + deserialized = self._deserialize("LocationsResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -96,17 +100,19 @@ 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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/providers/Microsoft.ImportExport/locations'} # type: ignore + @distributed_trace_async async def get( self, location_name: str, @@ -127,33 +133,22 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'locationName': self._serialize.url("location_name", location_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] - if self._config.accept_language is not None: - header_parameters['Accept-Language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + location_name=location_name, + accept_language=self._config.accept_language, + 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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Location', pipeline_response) @@ -162,4 +157,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/providers/Microsoft.ImportExport/locations/{locationName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/operations/_operations.py index d5fd8a8c7c8aa..b56debdf1f7eb 100644 --- a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Returns the list of operations supported by the import/export resource provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListOperationsResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~storage_import_export.models.ListOperationsResponse] + :return: An iterator like instance of either ListOperationsResponse or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~storage_import_export.models.ListOperationsResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListOperationsResponse"] @@ -57,32 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.accept_language is not None: - header_parameters['Accept-Language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') - 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( + accept_language=self._config.accept_language, + 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( + accept_language=self._config.accept_language, + 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('ListOperationsResponse', pipeline_response) + deserialized = self._deserialize("ListOperationsResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -95,12 +100,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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-storageimportexport/azure/mgmt/storageimportexport/models/_models.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_models.py index 85835b038804a..073f79e547d30 100644 --- a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_models.py +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_models.py @@ -15,15 +15,15 @@ class DeliveryPackageInformation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param carrier_name: Required. The name of the carrier that is used to ship the import or - export drives. - :type carrier_name: str - :param tracking_number: Required. The tracking number of the package. - :type tracking_number: str - :param drive_count: The number of drives included in the package. - :type drive_count: long - :param ship_date: The date when the package is shipped. - :type ship_date: str + :ivar carrier_name: Required. The name of the carrier that is used to ship the import or export + drives. + :vartype carrier_name: str + :ivar tracking_number: Required. The tracking number of the package. + :vartype tracking_number: str + :ivar drive_count: The number of drives included in the package. + :vartype drive_count: long + :ivar ship_date: The date when the package is shipped. + :vartype ship_date: str """ _validation = { @@ -42,6 +42,17 @@ def __init__( self, **kwargs ): + """ + :keyword carrier_name: Required. The name of the carrier that is used to ship the import or + export drives. + :paramtype carrier_name: str + :keyword tracking_number: Required. The tracking number of the package. + :paramtype tracking_number: str + :keyword drive_count: The number of drives included in the package. + :paramtype drive_count: long + :keyword ship_date: The date when the package is shipped. + :paramtype ship_date: str + """ super(DeliveryPackageInformation, self).__init__(**kwargs) self.carrier_name = kwargs['carrier_name'] self.tracking_number = kwargs['tracking_number'] @@ -52,10 +63,10 @@ def __init__( class DriveBitLockerKey(msrest.serialization.Model): """BitLocker recovery key or password to the specified drive. - :param bit_locker_key: BitLocker recovery key or password. - :type bit_locker_key: str - :param drive_id: Drive ID. - :type drive_id: str + :ivar bit_locker_key: BitLocker recovery key or password. + :vartype bit_locker_key: str + :ivar drive_id: Drive ID. + :vartype drive_id: str """ _attribute_map = { @@ -67,6 +78,12 @@ def __init__( self, **kwargs ): + """ + :keyword bit_locker_key: BitLocker recovery key or password. + :paramtype bit_locker_key: str + :keyword drive_id: Drive ID. + :paramtype drive_id: str + """ super(DriveBitLockerKey, self).__init__(**kwargs) self.bit_locker_key = kwargs.get('bit_locker_key', None) self.drive_id = kwargs.get('drive_id', None) @@ -75,34 +92,35 @@ def __init__( class DriveStatus(msrest.serialization.Model): """Provides information about the drive's status. - :param drive_id: The drive's hardware serial number, without spaces. - :type drive_id: str - :param bit_locker_key: The BitLocker key used to encrypt the drive. - :type bit_locker_key: str - :param manifest_file: The relative path of the manifest file on the drive. - :type manifest_file: str - :param manifest_hash: The Base16-encoded MD5 hash of the manifest file on the drive. - :type manifest_hash: str - :param drive_header_hash: The drive header hash value. - :type drive_header_hash: str - :param state: The drive's current state. Possible values include: "Specified", "Received", - "NeverReceived", "Transferring", "Completed", "CompletedMoreInfo", "ShippedBack". - :type state: str or ~storage_import_export.models.DriveState - :param copy_status: Detailed status about the data transfer process. This field is not returned + :ivar drive_id: The drive's hardware serial number, without spaces. + :vartype drive_id: str + :ivar bit_locker_key: The BitLocker key used to encrypt the drive. + :vartype bit_locker_key: str + :ivar manifest_file: The relative path of the manifest file on the drive. + :vartype manifest_file: str + :ivar manifest_hash: The Base16-encoded MD5 hash of the manifest file on the drive. + :vartype manifest_hash: str + :ivar drive_header_hash: The drive header hash value. + :vartype drive_header_hash: str + :ivar state: The drive's current state. Possible values include: "Specified", "Received", + "NeverReceived", "Transferring", "Completed", "CompletedMoreInfo", "ShippedBack". Default + value: "Specified". + :vartype state: str or ~storage_import_export.models.DriveState + :ivar copy_status: Detailed status about the data transfer process. This field is not returned in the response until the drive is in the Transferring state. - :type copy_status: str - :param percent_complete: Percentage completed for the drive. - :type percent_complete: long - :param verbose_log_uri: A URI that points to the blob containing the verbose log for the data + :vartype copy_status: str + :ivar percent_complete: Percentage completed for the drive. + :vartype percent_complete: long + :ivar verbose_log_uri: A URI that points to the blob containing the verbose log for the data transfer operation. - :type verbose_log_uri: str - :param error_log_uri: A URI that points to the blob containing the error log for the data + :vartype verbose_log_uri: str + :ivar error_log_uri: A URI that points to the blob containing the error log for the data transfer operation. - :type error_log_uri: str - :param manifest_uri: A URI that points to the blob containing the drive manifest file. - :type manifest_uri: str - :param bytes_succeeded: Bytes successfully transferred for the drive. - :type bytes_succeeded: long + :vartype error_log_uri: str + :ivar manifest_uri: A URI that points to the blob containing the drive manifest file. + :vartype manifest_uri: str + :ivar bytes_succeeded: Bytes successfully transferred for the drive. + :vartype bytes_succeeded: long """ _attribute_map = { @@ -124,13 +142,44 @@ def __init__( self, **kwargs ): + """ + :keyword drive_id: The drive's hardware serial number, without spaces. + :paramtype drive_id: str + :keyword bit_locker_key: The BitLocker key used to encrypt the drive. + :paramtype bit_locker_key: str + :keyword manifest_file: The relative path of the manifest file on the drive. + :paramtype manifest_file: str + :keyword manifest_hash: The Base16-encoded MD5 hash of the manifest file on the drive. + :paramtype manifest_hash: str + :keyword drive_header_hash: The drive header hash value. + :paramtype drive_header_hash: str + :keyword state: The drive's current state. Possible values include: "Specified", "Received", + "NeverReceived", "Transferring", "Completed", "CompletedMoreInfo", "ShippedBack". Default + value: "Specified". + :paramtype state: str or ~storage_import_export.models.DriveState + :keyword copy_status: Detailed status about the data transfer process. This field is not + returned in the response until the drive is in the Transferring state. + :paramtype copy_status: str + :keyword percent_complete: Percentage completed for the drive. + :paramtype percent_complete: long + :keyword verbose_log_uri: A URI that points to the blob containing the verbose log for the data + transfer operation. + :paramtype verbose_log_uri: str + :keyword error_log_uri: A URI that points to the blob containing the error log for the data + transfer operation. + :paramtype error_log_uri: str + :keyword manifest_uri: A URI that points to the blob containing the drive manifest file. + :paramtype manifest_uri: str + :keyword bytes_succeeded: Bytes successfully transferred for the drive. + :paramtype bytes_succeeded: long + """ super(DriveStatus, self).__init__(**kwargs) self.drive_id = kwargs.get('drive_id', None) self.bit_locker_key = kwargs.get('bit_locker_key', None) self.manifest_file = kwargs.get('manifest_file', None) self.manifest_hash = kwargs.get('manifest_hash', None) self.drive_header_hash = kwargs.get('drive_header_hash', None) - self.state = kwargs.get('state', None) + self.state = kwargs.get('state', "Specified") self.copy_status = kwargs.get('copy_status', None) self.percent_complete = kwargs.get('percent_complete', None) self.verbose_log_uri = kwargs.get('verbose_log_uri', None) @@ -142,13 +191,13 @@ def __init__( class EncryptionKeyDetails(msrest.serialization.Model): """Specifies the encryption key properties. - :param kek_type: The type of kek encryption key. Possible values include: "MicrosoftManaged", + :ivar kek_type: The type of kek encryption key. Possible values include: "MicrosoftManaged", "CustomerManaged". Default value: "MicrosoftManaged". - :type kek_type: str or ~storage_import_export.models.EncryptionKekType - :param kek_url: Specifies the url for kek encryption key. - :type kek_url: str - :param kek_vault_resource_id: Specifies the keyvault resource id for kek encryption key. - :type kek_vault_resource_id: str + :vartype kek_type: str or ~storage_import_export.models.EncryptionKekType + :ivar kek_url: Specifies the url for kek encryption key. + :vartype kek_url: str + :ivar kek_vault_resource_id: Specifies the keyvault resource id for kek encryption key. + :vartype kek_vault_resource_id: str """ _attribute_map = { @@ -161,6 +210,15 @@ def __init__( self, **kwargs ): + """ + :keyword kek_type: The type of kek encryption key. Possible values include: "MicrosoftManaged", + "CustomerManaged". Default value: "MicrosoftManaged". + :paramtype kek_type: str or ~storage_import_export.models.EncryptionKekType + :keyword kek_url: Specifies the url for kek encryption key. + :paramtype kek_url: str + :keyword kek_vault_resource_id: Specifies the keyvault resource id for kek encryption key. + :paramtype kek_vault_resource_id: str + """ super(EncryptionKeyDetails, self).__init__(**kwargs) self.kek_type = kwargs.get('kek_type', "MicrosoftManaged") self.kek_url = kwargs.get('kek_url', None) @@ -170,16 +228,16 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Response when errors occurred. - :param code: Provides information about the error code. - :type code: str - :param message: Provides information about the error message. - :type message: str - :param target: Provides information about the error target. - :type target: str - :param details: Describes the error details if present. - :type details: list[~storage_import_export.models.ErrorResponseErrorDetailsItem] - :param innererror: Inner error object if present. - :type innererror: any + :ivar code: Provides information about the error code. + :vartype code: str + :ivar message: Provides information about the error message. + :vartype message: str + :ivar target: Provides information about the error target. + :vartype target: str + :ivar details: Describes the error details if present. + :vartype details: list[~storage_import_export.models.ErrorResponseErrorDetailsItem] + :ivar innererror: Inner error object if present. + :vartype innererror: any """ _attribute_map = { @@ -194,6 +252,18 @@ def __init__( self, **kwargs ): + """ + :keyword code: Provides information about the error code. + :paramtype code: str + :keyword message: Provides information about the error message. + :paramtype message: str + :keyword target: Provides information about the error target. + :paramtype target: str + :keyword details: Describes the error details if present. + :paramtype details: list[~storage_import_export.models.ErrorResponseErrorDetailsItem] + :keyword innererror: Inner error object if present. + :paramtype innererror: any + """ super(ErrorResponse, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -205,12 +275,12 @@ def __init__( class ErrorResponseErrorDetailsItem(msrest.serialization.Model): """ErrorResponseErrorDetailsItem. - :param code: Provides information about the error code. - :type code: str - :param target: Provides information about the error target. - :type target: str - :param message: Provides information about the error message. - :type message: str + :ivar code: Provides information about the error code. + :vartype code: str + :ivar target: Provides information about the error target. + :vartype target: str + :ivar message: Provides information about the error message. + :vartype message: str """ _attribute_map = { @@ -223,6 +293,14 @@ def __init__( self, **kwargs ): + """ + :keyword code: Provides information about the error code. + :paramtype code: str + :keyword target: Provides information about the error target. + :paramtype target: str + :keyword message: Provides information about the error message. + :paramtype message: str + """ super(ErrorResponseErrorDetailsItem, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.target = kwargs.get('target', None) @@ -232,14 +310,14 @@ def __init__( class Export(msrest.serialization.Model): """A property containing information about the blobs to be exported for an export job. This property is required for export jobs, but must not be specified for import jobs. - :param blob_list_blob_path: The relative URI to the block blob that contains the list of blob + :ivar blob_list_blob_path: The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning with the container name. If the blob is in root container, the URI must begin with $root. - :type blob_list_blob_path: str - :param blob_path: A collection of blob-path strings. - :type blob_path: list[str] - :param blob_path_prefix: A collection of blob-prefix strings. - :type blob_path_prefix: list[str] + :vartype blob_list_blob_path: str + :ivar blob_path: A collection of blob-path strings. + :vartype blob_path: list[str] + :ivar blob_path_prefix: A collection of blob-prefix strings. + :vartype blob_path_prefix: list[str] """ _attribute_map = { @@ -252,6 +330,16 @@ def __init__( self, **kwargs ): + """ + :keyword blob_list_blob_path: The relative URI to the block blob that contains the list of blob + paths or blob path prefixes as defined above, beginning with the container name. If the blob is + in root container, the URI must begin with $root. + :paramtype blob_list_blob_path: str + :keyword blob_path: A collection of blob-path strings. + :paramtype blob_path: list[str] + :keyword blob_path_prefix: A collection of blob-prefix strings. + :paramtype blob_path_prefix: list[str] + """ super(Export, self).__init__(**kwargs) self.blob_list_blob_path = kwargs.get('blob_list_blob_path', None) self.blob_path = kwargs.get('blob_path', None) @@ -261,8 +349,8 @@ def __init__( class GetBitLockerKeysResponse(msrest.serialization.Model): """GetBitLockerKeys response. - :param value: drive status. - :type value: list[~storage_import_export.models.DriveBitLockerKey] + :ivar value: drive status. + :vartype value: list[~storage_import_export.models.DriveBitLockerKey] """ _attribute_map = { @@ -273,6 +361,10 @@ def __init__( self, **kwargs ): + """ + :keyword value: drive status. + :paramtype value: list[~storage_import_export.models.DriveBitLockerKey] + """ super(GetBitLockerKeysResponse, self).__init__(**kwargs) self.value = kwargs.get('value', None) @@ -282,9 +374,9 @@ class IdentityDetails(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param type: The type of identity. Possible values include: "None", "SystemAssigned", + :ivar type: The type of identity. Possible values include: "None", "SystemAssigned", "UserAssigned". Default value: "None". - :type type: str or ~storage_import_export.models.IdentityType + :vartype type: str or ~storage_import_export.models.IdentityType :ivar principal_id: Specifies the principal id for the identity for the job. :vartype principal_id: str :ivar tenant_id: Specifies the tenant id for the identity for the job. @@ -306,6 +398,11 @@ def __init__( self, **kwargs ): + """ + :keyword type: The type of identity. Possible values include: "None", "SystemAssigned", + "UserAssigned". Default value: "None". + :paramtype type: str or ~storage_import_export.models.IdentityType + """ super(IdentityDetails, self).__init__(**kwargs) self.type = kwargs.get('type', "None") self.principal_id = None @@ -315,54 +412,54 @@ def __init__( class JobDetails(msrest.serialization.Model): """Specifies the job properties. - :param storage_account_id: The resource identifier of the storage account where data will be + :ivar storage_account_id: The resource identifier of the storage account where data will be imported to or exported from. - :type storage_account_id: str - :param job_type: The type of job. - :type job_type: str - :param return_address: Specifies the return address information for the job. - :type return_address: ~storage_import_export.models.ReturnAddress - :param return_shipping: Specifies the return carrier and customer's account with the carrier. - :type return_shipping: ~storage_import_export.models.ReturnShipping - :param shipping_information: Contains information about the Microsoft datacenter to which the + :vartype storage_account_id: str + :ivar job_type: The type of job. + :vartype job_type: str + :ivar return_address: Specifies the return address information for the job. + :vartype return_address: ~storage_import_export.models.ReturnAddress + :ivar return_shipping: Specifies the return carrier and customer's account with the carrier. + :vartype return_shipping: ~storage_import_export.models.ReturnShipping + :ivar shipping_information: Contains information about the Microsoft datacenter to which the drives should be shipped. - :type shipping_information: ~storage_import_export.models.ShippingInformation - :param delivery_package: Contains information about the package being shipped by the customer - to the Microsoft data center. - :type delivery_package: ~storage_import_export.models.DeliveryPackageInformation - :param return_package: Contains information about the package being shipped from the Microsoft + :vartype shipping_information: ~storage_import_export.models.ShippingInformation + :ivar delivery_package: Contains information about the package being shipped by the customer to + the Microsoft data center. + :vartype delivery_package: ~storage_import_export.models.DeliveryPackageInformation + :ivar return_package: Contains information about the package being shipped from the Microsoft data center to the customer to return the drives. The format is the same as the deliveryPackage property above. This property is not included if the drives have not yet been returned. - :type return_package: ~storage_import_export.models.PackageInformation - :param diagnostics_path: The virtual blob directory to which the copy logs and backups of drive + :vartype return_package: ~storage_import_export.models.PackageInformation + :ivar diagnostics_path: The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored. - :type diagnostics_path: str - :param log_level: Default value is Error. Indicates whether error logging or verbose logging + :vartype diagnostics_path: str + :ivar log_level: Default value is Error. Indicates whether error logging or verbose logging will be enabled. - :type log_level: str - :param backup_drive_manifest: Default value is false. Indicates whether the manifest files on + :vartype log_level: str + :ivar backup_drive_manifest: Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs. - :type backup_drive_manifest: bool - :param state: Current state of the job. - :type state: str - :param cancel_requested: Indicates whether a request has been submitted to cancel the job. - :type cancel_requested: bool - :param percent_complete: Overall percentage completed for the job. - :type percent_complete: long - :param incomplete_blob_list_uri: A blob path that points to a block blob containing a list of + :vartype backup_drive_manifest: bool + :ivar state: Current state of the job. + :vartype state: str + :ivar cancel_requested: Indicates whether a request has been submitted to cancel the job. + :vartype cancel_requested: bool + :ivar percent_complete: Overall percentage completed for the job. + :vartype percent_complete: long + :ivar incomplete_blob_list_uri: A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive space. If all blobs were exported successfully, then this element is not included in the response. - :type incomplete_blob_list_uri: str - :param drive_list: List of up to ten drives that comprise the job. The drive list is a required + :vartype incomplete_blob_list_uri: str + :ivar drive_list: List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified for export jobs. - :type drive_list: list[~storage_import_export.models.DriveStatus] - :param export: A property containing information about the blobs to be exported for an export + :vartype drive_list: list[~storage_import_export.models.DriveStatus] + :ivar export: A property containing information about the blobs to be exported for an export job. This property is included for export jobs only. - :type export: ~storage_import_export.models.Export - :param provisioning_state: Specifies the provisioning state of the job. - :type provisioning_state: str - :param encryption_key: Contains information about the encryption key. - :type encryption_key: ~storage_import_export.models.EncryptionKeyDetails + :vartype export: ~storage_import_export.models.Export + :ivar provisioning_state: Specifies the provisioning state of the job. + :vartype provisioning_state: str + :ivar encryption_key: Contains information about the encryption key. + :vartype encryption_key: ~storage_import_export.models.EncryptionKeyDetails """ _attribute_map = { @@ -390,6 +487,57 @@ def __init__( self, **kwargs ): + """ + :keyword storage_account_id: The resource identifier of the storage account where data will be + imported to or exported from. + :paramtype storage_account_id: str + :keyword job_type: The type of job. + :paramtype job_type: str + :keyword return_address: Specifies the return address information for the job. + :paramtype return_address: ~storage_import_export.models.ReturnAddress + :keyword return_shipping: Specifies the return carrier and customer's account with the carrier. + :paramtype return_shipping: ~storage_import_export.models.ReturnShipping + :keyword shipping_information: Contains information about the Microsoft datacenter to which the + drives should be shipped. + :paramtype shipping_information: ~storage_import_export.models.ShippingInformation + :keyword delivery_package: Contains information about the package being shipped by the customer + to the Microsoft data center. + :paramtype delivery_package: ~storage_import_export.models.DeliveryPackageInformation + :keyword return_package: Contains information about the package being shipped from the + Microsoft data center to the customer to return the drives. The format is the same as the + deliveryPackage property above. This property is not included if the drives have not yet been + returned. + :paramtype return_package: ~storage_import_export.models.PackageInformation + :keyword diagnostics_path: The virtual blob directory to which the copy logs and backups of + drive manifest files (if enabled) will be stored. + :paramtype diagnostics_path: str + :keyword log_level: Default value is Error. Indicates whether error logging or verbose logging + will be enabled. + :paramtype log_level: str + :keyword backup_drive_manifest: Default value is false. Indicates whether the manifest files on + the drives should be copied to block blobs. + :paramtype backup_drive_manifest: bool + :keyword state: Current state of the job. + :paramtype state: str + :keyword cancel_requested: Indicates whether a request has been submitted to cancel the job. + :paramtype cancel_requested: bool + :keyword percent_complete: Overall percentage completed for the job. + :paramtype percent_complete: long + :keyword incomplete_blob_list_uri: A blob path that points to a block blob containing a list of + blob names that were not exported due to insufficient drive space. If all blobs were exported + successfully, then this element is not included in the response. + :paramtype incomplete_blob_list_uri: str + :keyword drive_list: List of up to ten drives that comprise the job. The drive list is a + required element for an import job; it is not specified for export jobs. + :paramtype drive_list: list[~storage_import_export.models.DriveStatus] + :keyword export: A property containing information about the blobs to be exported for an export + job. This property is included for export jobs only. + :paramtype export: ~storage_import_export.models.Export + :keyword provisioning_state: Specifies the provisioning state of the job. + :paramtype provisioning_state: str + :keyword encryption_key: Contains information about the encryption key. + :paramtype encryption_key: ~storage_import_export.models.EncryptionKeyDetails + """ super(JobDetails, self).__init__(**kwargs) self.storage_account_id = kwargs.get('storage_account_id', None) self.job_type = kwargs.get('job_type', None) @@ -400,9 +548,9 @@ def __init__( self.return_package = kwargs.get('return_package', None) self.diagnostics_path = kwargs.get('diagnostics_path', None) self.log_level = kwargs.get('log_level', None) - self.backup_drive_manifest = kwargs.get('backup_drive_manifest', None) - self.state = kwargs.get('state', None) - self.cancel_requested = kwargs.get('cancel_requested', None) + self.backup_drive_manifest = kwargs.get('backup_drive_manifest', False) + self.state = kwargs.get('state', "Creating") + self.cancel_requested = kwargs.get('cancel_requested', False) self.percent_complete = kwargs.get('percent_complete', None) self.incomplete_blob_list_uri = kwargs.get('incomplete_blob_list_uri', None) self.drive_list = kwargs.get('drive_list', None) @@ -424,14 +572,14 @@ class JobResponse(msrest.serialization.Model): :vartype name: str :ivar type: Specifies the type of the job resource. :vartype type: str - :param location: Specifies the Azure location where the job is created. - :type location: str - :param tags: A set of tags. Specifies the tags that are assigned to the job. - :type tags: any - :param properties: Specifies the job properties. - :type properties: ~storage_import_export.models.JobDetails - :param identity: Specifies the job identity details. - :type identity: ~storage_import_export.models.IdentityDetails + :ivar location: Specifies the Azure location where the job is created. + :vartype location: str + :ivar tags: A set of tags. Specifies the tags that are assigned to the job. + :vartype tags: any + :ivar properties: Specifies the job properties. + :vartype properties: ~storage_import_export.models.JobDetails + :ivar identity: Specifies the job identity details. + :vartype identity: ~storage_import_export.models.IdentityDetails """ _validation = { @@ -456,6 +604,16 @@ def __init__( self, **kwargs ): + """ + :keyword location: Specifies the Azure location where the job is created. + :paramtype location: str + :keyword tags: A set of tags. Specifies the tags that are assigned to the job. + :paramtype tags: any + :keyword properties: Specifies the job properties. + :paramtype properties: ~storage_import_export.models.JobDetails + :keyword identity: Specifies the job identity details. + :paramtype identity: ~storage_import_export.models.IdentityDetails + """ super(JobResponse, self).__init__(**kwargs) self.system_data = None self.id = None @@ -470,10 +628,10 @@ def __init__( class ListJobsResponse(msrest.serialization.Model): """List jobs response. - :param next_link: link to next batch of jobs. - :type next_link: str - :param value: Job list. - :type value: list[~storage_import_export.models.JobResponse] + :ivar next_link: link to next batch of jobs. + :vartype next_link: str + :ivar value: Job list. + :vartype value: list[~storage_import_export.models.JobResponse] """ _attribute_map = { @@ -485,6 +643,12 @@ def __init__( self, **kwargs ): + """ + :keyword next_link: link to next batch of jobs. + :paramtype next_link: str + :keyword value: Job list. + :paramtype value: list[~storage_import_export.models.JobResponse] + """ super(ListJobsResponse, self).__init__(**kwargs) self.next_link = kwargs.get('next_link', None) self.value = kwargs.get('value', None) @@ -493,8 +657,8 @@ def __init__( class ListOperationsResponse(msrest.serialization.Model): """List operations response. - :param value: operations. - :type value: list[~storage_import_export.models.Operation] + :ivar value: operations. + :vartype value: list[~storage_import_export.models.Operation] """ _attribute_map = { @@ -505,6 +669,10 @@ def __init__( self, **kwargs ): + """ + :keyword value: operations. + :paramtype value: list[~storage_import_export.models.Operation] + """ super(ListOperationsResponse, self).__init__(**kwargs) self.value = kwargs.get('value', None) @@ -512,44 +680,44 @@ def __init__( class Location(msrest.serialization.Model): """Provides information about an Azure data center location. - :param id: Specifies the resource identifier of the location. - :type id: str - :param name: Specifies the name of the location. Use List Locations to get all supported + :ivar id: Specifies the resource identifier of the location. + :vartype id: str + :ivar name: Specifies the name of the location. Use List Locations to get all supported locations. - :type name: str - :param type: Specifies the type of the location. - :type type: str - :param recipient_name: The recipient name to use when shipping the drives to the Azure data + :vartype name: str + :ivar type: Specifies the type of the location. + :vartype type: str + :ivar recipient_name: The recipient name to use when shipping the drives to the Azure data center. - :type recipient_name: str - :param street_address1: The first line of the street address to use when shipping the drives to + :vartype recipient_name: str + :ivar street_address1: The first line of the street address to use when shipping the drives to + the Azure data center. + :vartype street_address1: str + :ivar street_address2: The second line of the street address to use when shipping the drives to the Azure data center. - :type street_address1: str - :param street_address2: The second line of the street address to use when shipping the drives - to the Azure data center. - :type street_address2: str - :param city: The city name to use when shipping the drives to the Azure data center. - :type city: str - :param state_or_province: The state or province to use when shipping the drives to the Azure + :vartype street_address2: str + :ivar city: The city name to use when shipping the drives to the Azure data center. + :vartype city: str + :ivar state_or_province: The state or province to use when shipping the drives to the Azure data center. - :type state_or_province: str - :param postal_code: The postal code to use when shipping the drives to the Azure data center. - :type postal_code: str - :param country_or_region: The country or region to use when shipping the drives to the Azure + :vartype state_or_province: str + :ivar postal_code: The postal code to use when shipping the drives to the Azure data center. + :vartype postal_code: str + :ivar country_or_region: The country or region to use when shipping the drives to the Azure data center. - :type country_or_region: str - :param phone: The phone number for the Azure data center. - :type phone: str - :param additional_shipping_information: Additional shipping information for customer, specific + :vartype country_or_region: str + :ivar phone: The phone number for the Azure data center. + :vartype phone: str + :ivar additional_shipping_information: Additional shipping information for customer, specific to datacenter to which customer should send their disks. - :type additional_shipping_information: str - :param supported_carriers: A list of carriers that are supported at this location. - :type supported_carriers: list[str] - :param alternate_locations: A list of location IDs that should be used to ship shipping drives + :vartype additional_shipping_information: str + :ivar supported_carriers: A list of carriers that are supported at this location. + :vartype supported_carriers: list[str] + :ivar alternate_locations: A list of location IDs that should be used to ship shipping drives to for jobs created against the current location. If the current location is active, it will be part of the list. If it is temporarily closed due to maintenance, this list may contain other locations. - :type alternate_locations: list[str] + :vartype alternate_locations: list[str] """ _attribute_map = { @@ -573,6 +741,46 @@ def __init__( self, **kwargs ): + """ + :keyword id: Specifies the resource identifier of the location. + :paramtype id: str + :keyword name: Specifies the name of the location. Use List Locations to get all supported + locations. + :paramtype name: str + :keyword type: Specifies the type of the location. + :paramtype type: str + :keyword recipient_name: The recipient name to use when shipping the drives to the Azure data + center. + :paramtype recipient_name: str + :keyword street_address1: The first line of the street address to use when shipping the drives + to the Azure data center. + :paramtype street_address1: str + :keyword street_address2: The second line of the street address to use when shipping the drives + to the Azure data center. + :paramtype street_address2: str + :keyword city: The city name to use when shipping the drives to the Azure data center. + :paramtype city: str + :keyword state_or_province: The state or province to use when shipping the drives to the Azure + data center. + :paramtype state_or_province: str + :keyword postal_code: The postal code to use when shipping the drives to the Azure data center. + :paramtype postal_code: str + :keyword country_or_region: The country or region to use when shipping the drives to the Azure + data center. + :paramtype country_or_region: str + :keyword phone: The phone number for the Azure data center. + :paramtype phone: str + :keyword additional_shipping_information: Additional shipping information for customer, + specific to datacenter to which customer should send their disks. + :paramtype additional_shipping_information: str + :keyword supported_carriers: A list of carriers that are supported at this location. + :paramtype supported_carriers: list[str] + :keyword alternate_locations: A list of location IDs that should be used to ship shipping + drives to for jobs created against the current location. If the current location is active, it + will be part of the list. If it is temporarily closed due to maintenance, this list may contain + other locations. + :paramtype alternate_locations: list[str] + """ super(Location, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = kwargs.get('name', None) @@ -593,8 +801,8 @@ def __init__( class LocationsResponse(msrest.serialization.Model): """Locations response. - :param value: locations. - :type value: list[~storage_import_export.models.Location] + :ivar value: locations. + :vartype value: list[~storage_import_export.models.Location] """ _attribute_map = { @@ -605,6 +813,10 @@ def __init__( self, **kwargs ): + """ + :keyword value: locations. + :paramtype value: list[~storage_import_export.models.Location] + """ super(LocationsResponse, self).__init__(**kwargs) self.value = kwargs.get('value', None) @@ -614,16 +826,16 @@ class Operation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the operation. - :type name: str - :param provider: The resource provider name to which the operation belongs. - :type provider: str - :param resource: The name of the resource to which the operation belongs. - :type resource: str - :param operation: The display name of the operation. - :type operation: str - :param description: Short description of the operation. - :type description: str + :ivar name: Required. Name of the operation. + :vartype name: str + :ivar provider: The resource provider name to which the operation belongs. + :vartype provider: str + :ivar resource: The name of the resource to which the operation belongs. + :vartype resource: str + :ivar operation: The display name of the operation. + :vartype operation: str + :ivar description: Short description of the operation. + :vartype description: str """ _validation = { @@ -642,6 +854,18 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. Name of the operation. + :paramtype name: str + :keyword provider: The resource provider name to which the operation belongs. + :paramtype provider: str + :keyword resource: The name of the resource to which the operation belongs. + :paramtype resource: str + :keyword operation: The display name of the operation. + :paramtype operation: str + :keyword description: Short description of the operation. + :paramtype description: str + """ super(Operation, self).__init__(**kwargs) self.name = kwargs['name'] self.provider = kwargs.get('provider', None) @@ -655,15 +879,15 @@ class PackageInformation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param carrier_name: Required. The name of the carrier that is used to ship the import or - export drives. - :type carrier_name: str - :param tracking_number: Required. The tracking number of the package. - :type tracking_number: str - :param drive_count: Required. The number of drives included in the package. - :type drive_count: long - :param ship_date: Required. The date when the package is shipped. - :type ship_date: str + :ivar carrier_name: Required. The name of the carrier that is used to ship the import or export + drives. + :vartype carrier_name: str + :ivar tracking_number: Required. The tracking number of the package. + :vartype tracking_number: str + :ivar drive_count: Required. The number of drives included in the package. + :vartype drive_count: long + :ivar ship_date: Required. The date when the package is shipped. + :vartype ship_date: str """ _validation = { @@ -684,6 +908,17 @@ def __init__( self, **kwargs ): + """ + :keyword carrier_name: Required. The name of the carrier that is used to ship the import or + export drives. + :paramtype carrier_name: str + :keyword tracking_number: Required. The tracking number of the package. + :paramtype tracking_number: str + :keyword drive_count: Required. The number of drives included in the package. + :paramtype drive_count: long + :keyword ship_date: Required. The date when the package is shipped. + :paramtype ship_date: str + """ super(PackageInformation, self).__init__(**kwargs) self.carrier_name = kwargs['carrier_name'] self.tracking_number = kwargs['tracking_number'] @@ -694,12 +929,12 @@ def __init__( class PutJobParameters(msrest.serialization.Model): """Put Job parameters. - :param location: Specifies the supported Azure location where the job should be created. - :type location: str - :param tags: A set of tags. Specifies the tags that will be assigned to the job. - :type tags: any - :param properties: Specifies the job properties. - :type properties: ~storage_import_export.models.JobDetails + :ivar location: Specifies the supported Azure location where the job should be created. + :vartype location: str + :ivar tags: A set of tags. Specifies the tags that will be assigned to the job. + :vartype tags: any + :ivar properties: Specifies the job properties. + :vartype properties: ~storage_import_export.models.JobDetails """ _attribute_map = { @@ -712,6 +947,14 @@ def __init__( self, **kwargs ): + """ + :keyword location: Specifies the supported Azure location where the job should be created. + :paramtype location: str + :keyword tags: A set of tags. Specifies the tags that will be assigned to the job. + :paramtype tags: any + :keyword properties: Specifies the job properties. + :paramtype properties: ~storage_import_export.models.JobDetails + """ super(PutJobParameters, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.tags = kwargs.get('tags', None) @@ -723,26 +966,26 @@ class ReturnAddress(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param recipient_name: Required. The name of the recipient who will receive the hard drives - when they are returned. - :type recipient_name: str - :param street_address1: Required. The first line of the street address to use when returning - the drives. - :type street_address1: str - :param street_address2: The second line of the street address to use when returning the drives. - :type street_address2: str - :param city: Required. The city name to use when returning the drives. - :type city: str - :param state_or_province: The state or province to use when returning the drives. - :type state_or_province: str - :param postal_code: Required. The postal code to use when returning the drives. - :type postal_code: str - :param country_or_region: Required. The country or region to use when returning the drives. - :type country_or_region: str - :param phone: Required. Phone number of the recipient of the returned drives. - :type phone: str - :param email: Required. Email address of the recipient of the returned drives. - :type email: str + :ivar recipient_name: Required. The name of the recipient who will receive the hard drives when + they are returned. + :vartype recipient_name: str + :ivar street_address1: Required. The first line of the street address to use when returning the + drives. + :vartype street_address1: str + :ivar street_address2: The second line of the street address to use when returning the drives. + :vartype street_address2: str + :ivar city: Required. The city name to use when returning the drives. + :vartype city: str + :ivar state_or_province: The state or province to use when returning the drives. + :vartype state_or_province: str + :ivar postal_code: Required. The postal code to use when returning the drives. + :vartype postal_code: str + :ivar country_or_region: Required. The country or region to use when returning the drives. + :vartype country_or_region: str + :ivar phone: Required. Phone number of the recipient of the returned drives. + :vartype phone: str + :ivar email: Required. Email address of the recipient of the returned drives. + :vartype email: str """ _validation = { @@ -771,6 +1014,29 @@ def __init__( self, **kwargs ): + """ + :keyword recipient_name: Required. The name of the recipient who will receive the hard drives + when they are returned. + :paramtype recipient_name: str + :keyword street_address1: Required. The first line of the street address to use when returning + the drives. + :paramtype street_address1: str + :keyword street_address2: The second line of the street address to use when returning the + drives. + :paramtype street_address2: str + :keyword city: Required. The city name to use when returning the drives. + :paramtype city: str + :keyword state_or_province: The state or province to use when returning the drives. + :paramtype state_or_province: str + :keyword postal_code: Required. The postal code to use when returning the drives. + :paramtype postal_code: str + :keyword country_or_region: Required. The country or region to use when returning the drives. + :paramtype country_or_region: str + :keyword phone: Required. Phone number of the recipient of the returned drives. + :paramtype phone: str + :keyword email: Required. Email address of the recipient of the returned drives. + :paramtype email: str + """ super(ReturnAddress, self).__init__(**kwargs) self.recipient_name = kwargs['recipient_name'] self.street_address1 = kwargs['street_address1'] @@ -788,10 +1054,10 @@ class ReturnShipping(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param carrier_name: Required. The carrier's name. - :type carrier_name: str - :param carrier_account_number: Required. The customer's account number with the carrier. - :type carrier_account_number: str + :ivar carrier_name: Required. The carrier's name. + :vartype carrier_name: str + :ivar carrier_account_number: Required. The customer's account number with the carrier. + :vartype carrier_account_number: str """ _validation = { @@ -808,6 +1074,12 @@ def __init__( self, **kwargs ): + """ + :keyword carrier_name: Required. The carrier's name. + :paramtype carrier_name: str + :keyword carrier_account_number: Required. The customer's account number with the carrier. + :paramtype carrier_account_number: str + """ super(ReturnShipping, self).__init__(**kwargs) self.carrier_name = kwargs['carrier_name'] self.carrier_account_number = kwargs['carrier_account_number'] @@ -818,23 +1090,23 @@ class ShippingInformation(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param recipient_name: The name of the recipient who will receive the hard drives when they are + :ivar recipient_name: The name of the recipient who will receive the hard drives when they are returned. - :type recipient_name: str - :param street_address1: The first line of the street address to use when returning the drives. - :type street_address1: str - :param street_address2: The second line of the street address to use when returning the drives. - :type street_address2: str - :param city: The city name to use when returning the drives. - :type city: str - :param state_or_province: The state or province to use when returning the drives. - :type state_or_province: str - :param postal_code: The postal code to use when returning the drives. - :type postal_code: str - :param country_or_region: The country or region to use when returning the drives. - :type country_or_region: str - :param phone: Phone number of the recipient of the returned drives. - :type phone: str + :vartype recipient_name: str + :ivar street_address1: The first line of the street address to use when returning the drives. + :vartype street_address1: str + :ivar street_address2: The second line of the street address to use when returning the drives. + :vartype street_address2: str + :ivar city: The city name to use when returning the drives. + :vartype city: str + :ivar state_or_province: The state or province to use when returning the drives. + :vartype state_or_province: str + :ivar postal_code: The postal code to use when returning the drives. + :vartype postal_code: str + :ivar country_or_region: The country or region to use when returning the drives. + :vartype country_or_region: str + :ivar phone: Phone number of the recipient of the returned drives. + :vartype phone: str :ivar additional_information: Additional shipping information for customer, specific to datacenter to which customer should send their disks. :vartype additional_information: str @@ -860,6 +1132,27 @@ def __init__( self, **kwargs ): + """ + :keyword recipient_name: The name of the recipient who will receive the hard drives when they + are returned. + :paramtype recipient_name: str + :keyword street_address1: The first line of the street address to use when returning the + drives. + :paramtype street_address1: str + :keyword street_address2: The second line of the street address to use when returning the + drives. + :paramtype street_address2: str + :keyword city: The city name to use when returning the drives. + :paramtype city: str + :keyword state_or_province: The state or province to use when returning the drives. + :paramtype state_or_province: str + :keyword postal_code: The postal code to use when returning the drives. + :paramtype postal_code: str + :keyword country_or_region: The country or region to use when returning the drives. + :paramtype country_or_region: str + :keyword phone: Phone number of the recipient of the returned drives. + :paramtype phone: str + """ super(ShippingInformation, self).__init__(**kwargs) self.recipient_name = kwargs.get('recipient_name', None) self.street_address1 = kwargs.get('street_address1', None) @@ -875,20 +1168,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~storage_import_export.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :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 ~storage_import_export.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". - :type last_modified_by_type: str or ~storage_import_export.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~storage_import_export.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -904,6 +1197,22 @@ def __init__( self, **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 ~storage_import_export.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 ~storage_import_export.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 = kwargs.get('created_by', None) self.created_by_type = kwargs.get('created_by_type', None) @@ -916,30 +1225,30 @@ def __init__( class UpdateJobParameters(msrest.serialization.Model): """Update Job parameters. - :param tags: A set of tags. Specifies the tags that will be assigned to the job. - :type tags: any - :param cancel_requested: If specified, the value must be true. The service will attempt to + :ivar tags: A set of tags. Specifies the tags that will be assigned to the job. + :vartype tags: any + :ivar cancel_requested: If specified, the value must be true. The service will attempt to cancel the job. - :type cancel_requested: bool - :param state: If specified, the value must be Shipping, which tells the Import/Export service + :vartype cancel_requested: bool + :ivar state: If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been shipped. The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, otherwise the request will fail. - :type state: str - :param return_address: Specifies the return address information for the job. - :type return_address: ~storage_import_export.models.ReturnAddress - :param return_shipping: Specifies the return carrier and customer's account with the carrier. - :type return_shipping: ~storage_import_export.models.ReturnShipping - :param delivery_package: Contains information about the package being shipped by the customer - to the Microsoft data center. - :type delivery_package: ~storage_import_export.models.DeliveryPackageInformation - :param log_level: Indicates whether error logging or verbose logging is enabled. - :type log_level: str - :param backup_drive_manifest: Indicates whether the manifest files on the drives should be + :vartype state: str + :ivar return_address: Specifies the return address information for the job. + :vartype return_address: ~storage_import_export.models.ReturnAddress + :ivar return_shipping: Specifies the return carrier and customer's account with the carrier. + :vartype return_shipping: ~storage_import_export.models.ReturnShipping + :ivar delivery_package: Contains information about the package being shipped by the customer to + the Microsoft data center. + :vartype delivery_package: ~storage_import_export.models.DeliveryPackageInformation + :ivar log_level: Indicates whether error logging or verbose logging is enabled. + :vartype log_level: str + :ivar backup_drive_manifest: Indicates whether the manifest files on the drives should be copied to block blobs. - :type backup_drive_manifest: bool - :param drive_list: List of drives that comprise the job. - :type drive_list: list[~storage_import_export.models.DriveStatus] + :vartype backup_drive_manifest: bool + :ivar drive_list: List of drives that comprise the job. + :vartype drive_list: list[~storage_import_export.models.DriveStatus] """ _attribute_map = { @@ -958,13 +1267,39 @@ def __init__( self, **kwargs ): + """ + :keyword tags: A set of tags. Specifies the tags that will be assigned to the job. + :paramtype tags: any + :keyword cancel_requested: If specified, the value must be true. The service will attempt to + cancel the job. + :paramtype cancel_requested: bool + :keyword state: If specified, the value must be Shipping, which tells the Import/Export service + that the package for the job has been shipped. The ReturnAddress and DeliveryPackage properties + must have been set either in this request or in a previous request, otherwise the request will + fail. + :paramtype state: str + :keyword return_address: Specifies the return address information for the job. + :paramtype return_address: ~storage_import_export.models.ReturnAddress + :keyword return_shipping: Specifies the return carrier and customer's account with the carrier. + :paramtype return_shipping: ~storage_import_export.models.ReturnShipping + :keyword delivery_package: Contains information about the package being shipped by the customer + to the Microsoft data center. + :paramtype delivery_package: ~storage_import_export.models.DeliveryPackageInformation + :keyword log_level: Indicates whether error logging or verbose logging is enabled. + :paramtype log_level: str + :keyword backup_drive_manifest: Indicates whether the manifest files on the drives should be + copied to block blobs. + :paramtype backup_drive_manifest: bool + :keyword drive_list: List of drives that comprise the job. + :paramtype drive_list: list[~storage_import_export.models.DriveStatus] + """ super(UpdateJobParameters, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) - self.cancel_requested = kwargs.get('cancel_requested', None) + self.cancel_requested = kwargs.get('cancel_requested', False) self.state = kwargs.get('state', None) self.return_address = kwargs.get('return_address', None) self.return_shipping = kwargs.get('return_shipping', None) self.delivery_package = kwargs.get('delivery_package', None) self.log_level = kwargs.get('log_level', None) - self.backup_drive_manifest = kwargs.get('backup_drive_manifest', None) + self.backup_drive_manifest = kwargs.get('backup_drive_manifest', False) self.drive_list = kwargs.get('drive_list', None) diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_models_py3.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_models_py3.py index 2ddeb31c5fcdb..bd0def6be4a20 100644 --- a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_models_py3.py @@ -20,15 +20,15 @@ class DeliveryPackageInformation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param carrier_name: Required. The name of the carrier that is used to ship the import or - export drives. - :type carrier_name: str - :param tracking_number: Required. The tracking number of the package. - :type tracking_number: str - :param drive_count: The number of drives included in the package. - :type drive_count: long - :param ship_date: The date when the package is shipped. - :type ship_date: str + :ivar carrier_name: Required. The name of the carrier that is used to ship the import or export + drives. + :vartype carrier_name: str + :ivar tracking_number: Required. The tracking number of the package. + :vartype tracking_number: str + :ivar drive_count: The number of drives included in the package. + :vartype drive_count: long + :ivar ship_date: The date when the package is shipped. + :vartype ship_date: str """ _validation = { @@ -52,6 +52,17 @@ def __init__( ship_date: Optional[str] = None, **kwargs ): + """ + :keyword carrier_name: Required. The name of the carrier that is used to ship the import or + export drives. + :paramtype carrier_name: str + :keyword tracking_number: Required. The tracking number of the package. + :paramtype tracking_number: str + :keyword drive_count: The number of drives included in the package. + :paramtype drive_count: long + :keyword ship_date: The date when the package is shipped. + :paramtype ship_date: str + """ super(DeliveryPackageInformation, self).__init__(**kwargs) self.carrier_name = carrier_name self.tracking_number = tracking_number @@ -62,10 +73,10 @@ def __init__( class DriveBitLockerKey(msrest.serialization.Model): """BitLocker recovery key or password to the specified drive. - :param bit_locker_key: BitLocker recovery key or password. - :type bit_locker_key: str - :param drive_id: Drive ID. - :type drive_id: str + :ivar bit_locker_key: BitLocker recovery key or password. + :vartype bit_locker_key: str + :ivar drive_id: Drive ID. + :vartype drive_id: str """ _attribute_map = { @@ -80,6 +91,12 @@ def __init__( drive_id: Optional[str] = None, **kwargs ): + """ + :keyword bit_locker_key: BitLocker recovery key or password. + :paramtype bit_locker_key: str + :keyword drive_id: Drive ID. + :paramtype drive_id: str + """ super(DriveBitLockerKey, self).__init__(**kwargs) self.bit_locker_key = bit_locker_key self.drive_id = drive_id @@ -88,34 +105,35 @@ def __init__( class DriveStatus(msrest.serialization.Model): """Provides information about the drive's status. - :param drive_id: The drive's hardware serial number, without spaces. - :type drive_id: str - :param bit_locker_key: The BitLocker key used to encrypt the drive. - :type bit_locker_key: str - :param manifest_file: The relative path of the manifest file on the drive. - :type manifest_file: str - :param manifest_hash: The Base16-encoded MD5 hash of the manifest file on the drive. - :type manifest_hash: str - :param drive_header_hash: The drive header hash value. - :type drive_header_hash: str - :param state: The drive's current state. Possible values include: "Specified", "Received", - "NeverReceived", "Transferring", "Completed", "CompletedMoreInfo", "ShippedBack". - :type state: str or ~storage_import_export.models.DriveState - :param copy_status: Detailed status about the data transfer process. This field is not returned + :ivar drive_id: The drive's hardware serial number, without spaces. + :vartype drive_id: str + :ivar bit_locker_key: The BitLocker key used to encrypt the drive. + :vartype bit_locker_key: str + :ivar manifest_file: The relative path of the manifest file on the drive. + :vartype manifest_file: str + :ivar manifest_hash: The Base16-encoded MD5 hash of the manifest file on the drive. + :vartype manifest_hash: str + :ivar drive_header_hash: The drive header hash value. + :vartype drive_header_hash: str + :ivar state: The drive's current state. Possible values include: "Specified", "Received", + "NeverReceived", "Transferring", "Completed", "CompletedMoreInfo", "ShippedBack". Default + value: "Specified". + :vartype state: str or ~storage_import_export.models.DriveState + :ivar copy_status: Detailed status about the data transfer process. This field is not returned in the response until the drive is in the Transferring state. - :type copy_status: str - :param percent_complete: Percentage completed for the drive. - :type percent_complete: long - :param verbose_log_uri: A URI that points to the blob containing the verbose log for the data + :vartype copy_status: str + :ivar percent_complete: Percentage completed for the drive. + :vartype percent_complete: long + :ivar verbose_log_uri: A URI that points to the blob containing the verbose log for the data transfer operation. - :type verbose_log_uri: str - :param error_log_uri: A URI that points to the blob containing the error log for the data + :vartype verbose_log_uri: str + :ivar error_log_uri: A URI that points to the blob containing the error log for the data transfer operation. - :type error_log_uri: str - :param manifest_uri: A URI that points to the blob containing the drive manifest file. - :type manifest_uri: str - :param bytes_succeeded: Bytes successfully transferred for the drive. - :type bytes_succeeded: long + :vartype error_log_uri: str + :ivar manifest_uri: A URI that points to the blob containing the drive manifest file. + :vartype manifest_uri: str + :ivar bytes_succeeded: Bytes successfully transferred for the drive. + :vartype bytes_succeeded: long """ _attribute_map = { @@ -141,7 +159,7 @@ def __init__( manifest_file: Optional[str] = None, manifest_hash: Optional[str] = None, drive_header_hash: Optional[str] = None, - state: Optional[Union[str, "DriveState"]] = None, + state: Optional[Union[str, "DriveState"]] = "Specified", copy_status: Optional[str] = None, percent_complete: Optional[int] = None, verbose_log_uri: Optional[str] = None, @@ -150,6 +168,37 @@ def __init__( bytes_succeeded: Optional[int] = None, **kwargs ): + """ + :keyword drive_id: The drive's hardware serial number, without spaces. + :paramtype drive_id: str + :keyword bit_locker_key: The BitLocker key used to encrypt the drive. + :paramtype bit_locker_key: str + :keyword manifest_file: The relative path of the manifest file on the drive. + :paramtype manifest_file: str + :keyword manifest_hash: The Base16-encoded MD5 hash of the manifest file on the drive. + :paramtype manifest_hash: str + :keyword drive_header_hash: The drive header hash value. + :paramtype drive_header_hash: str + :keyword state: The drive's current state. Possible values include: "Specified", "Received", + "NeverReceived", "Transferring", "Completed", "CompletedMoreInfo", "ShippedBack". Default + value: "Specified". + :paramtype state: str or ~storage_import_export.models.DriveState + :keyword copy_status: Detailed status about the data transfer process. This field is not + returned in the response until the drive is in the Transferring state. + :paramtype copy_status: str + :keyword percent_complete: Percentage completed for the drive. + :paramtype percent_complete: long + :keyword verbose_log_uri: A URI that points to the blob containing the verbose log for the data + transfer operation. + :paramtype verbose_log_uri: str + :keyword error_log_uri: A URI that points to the blob containing the error log for the data + transfer operation. + :paramtype error_log_uri: str + :keyword manifest_uri: A URI that points to the blob containing the drive manifest file. + :paramtype manifest_uri: str + :keyword bytes_succeeded: Bytes successfully transferred for the drive. + :paramtype bytes_succeeded: long + """ super(DriveStatus, self).__init__(**kwargs) self.drive_id = drive_id self.bit_locker_key = bit_locker_key @@ -168,13 +217,13 @@ def __init__( class EncryptionKeyDetails(msrest.serialization.Model): """Specifies the encryption key properties. - :param kek_type: The type of kek encryption key. Possible values include: "MicrosoftManaged", + :ivar kek_type: The type of kek encryption key. Possible values include: "MicrosoftManaged", "CustomerManaged". Default value: "MicrosoftManaged". - :type kek_type: str or ~storage_import_export.models.EncryptionKekType - :param kek_url: Specifies the url for kek encryption key. - :type kek_url: str - :param kek_vault_resource_id: Specifies the keyvault resource id for kek encryption key. - :type kek_vault_resource_id: str + :vartype kek_type: str or ~storage_import_export.models.EncryptionKekType + :ivar kek_url: Specifies the url for kek encryption key. + :vartype kek_url: str + :ivar kek_vault_resource_id: Specifies the keyvault resource id for kek encryption key. + :vartype kek_vault_resource_id: str """ _attribute_map = { @@ -191,6 +240,15 @@ def __init__( kek_vault_resource_id: Optional[str] = None, **kwargs ): + """ + :keyword kek_type: The type of kek encryption key. Possible values include: "MicrosoftManaged", + "CustomerManaged". Default value: "MicrosoftManaged". + :paramtype kek_type: str or ~storage_import_export.models.EncryptionKekType + :keyword kek_url: Specifies the url for kek encryption key. + :paramtype kek_url: str + :keyword kek_vault_resource_id: Specifies the keyvault resource id for kek encryption key. + :paramtype kek_vault_resource_id: str + """ super(EncryptionKeyDetails, self).__init__(**kwargs) self.kek_type = kek_type self.kek_url = kek_url @@ -200,16 +258,16 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Response when errors occurred. - :param code: Provides information about the error code. - :type code: str - :param message: Provides information about the error message. - :type message: str - :param target: Provides information about the error target. - :type target: str - :param details: Describes the error details if present. - :type details: list[~storage_import_export.models.ErrorResponseErrorDetailsItem] - :param innererror: Inner error object if present. - :type innererror: any + :ivar code: Provides information about the error code. + :vartype code: str + :ivar message: Provides information about the error message. + :vartype message: str + :ivar target: Provides information about the error target. + :vartype target: str + :ivar details: Describes the error details if present. + :vartype details: list[~storage_import_export.models.ErrorResponseErrorDetailsItem] + :ivar innererror: Inner error object if present. + :vartype innererror: any """ _attribute_map = { @@ -230,6 +288,18 @@ def __init__( innererror: Optional[Any] = None, **kwargs ): + """ + :keyword code: Provides information about the error code. + :paramtype code: str + :keyword message: Provides information about the error message. + :paramtype message: str + :keyword target: Provides information about the error target. + :paramtype target: str + :keyword details: Describes the error details if present. + :paramtype details: list[~storage_import_export.models.ErrorResponseErrorDetailsItem] + :keyword innererror: Inner error object if present. + :paramtype innererror: any + """ super(ErrorResponse, self).__init__(**kwargs) self.code = code self.message = message @@ -241,12 +311,12 @@ def __init__( class ErrorResponseErrorDetailsItem(msrest.serialization.Model): """ErrorResponseErrorDetailsItem. - :param code: Provides information about the error code. - :type code: str - :param target: Provides information about the error target. - :type target: str - :param message: Provides information about the error message. - :type message: str + :ivar code: Provides information about the error code. + :vartype code: str + :ivar target: Provides information about the error target. + :vartype target: str + :ivar message: Provides information about the error message. + :vartype message: str """ _attribute_map = { @@ -263,6 +333,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: Provides information about the error code. + :paramtype code: str + :keyword target: Provides information about the error target. + :paramtype target: str + :keyword message: Provides information about the error message. + :paramtype message: str + """ super(ErrorResponseErrorDetailsItem, self).__init__(**kwargs) self.code = code self.target = target @@ -272,14 +350,14 @@ def __init__( class Export(msrest.serialization.Model): """A property containing information about the blobs to be exported for an export job. This property is required for export jobs, but must not be specified for import jobs. - :param blob_list_blob_path: The relative URI to the block blob that contains the list of blob + :ivar blob_list_blob_path: The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning with the container name. If the blob is in root container, the URI must begin with $root. - :type blob_list_blob_path: str - :param blob_path: A collection of blob-path strings. - :type blob_path: list[str] - :param blob_path_prefix: A collection of blob-prefix strings. - :type blob_path_prefix: list[str] + :vartype blob_list_blob_path: str + :ivar blob_path: A collection of blob-path strings. + :vartype blob_path: list[str] + :ivar blob_path_prefix: A collection of blob-prefix strings. + :vartype blob_path_prefix: list[str] """ _attribute_map = { @@ -296,6 +374,16 @@ def __init__( blob_path_prefix: Optional[List[str]] = None, **kwargs ): + """ + :keyword blob_list_blob_path: The relative URI to the block blob that contains the list of blob + paths or blob path prefixes as defined above, beginning with the container name. If the blob is + in root container, the URI must begin with $root. + :paramtype blob_list_blob_path: str + :keyword blob_path: A collection of blob-path strings. + :paramtype blob_path: list[str] + :keyword blob_path_prefix: A collection of blob-prefix strings. + :paramtype blob_path_prefix: list[str] + """ super(Export, self).__init__(**kwargs) self.blob_list_blob_path = blob_list_blob_path self.blob_path = blob_path @@ -305,8 +393,8 @@ def __init__( class GetBitLockerKeysResponse(msrest.serialization.Model): """GetBitLockerKeys response. - :param value: drive status. - :type value: list[~storage_import_export.models.DriveBitLockerKey] + :ivar value: drive status. + :vartype value: list[~storage_import_export.models.DriveBitLockerKey] """ _attribute_map = { @@ -319,6 +407,10 @@ def __init__( value: Optional[List["DriveBitLockerKey"]] = None, **kwargs ): + """ + :keyword value: drive status. + :paramtype value: list[~storage_import_export.models.DriveBitLockerKey] + """ super(GetBitLockerKeysResponse, self).__init__(**kwargs) self.value = value @@ -328,9 +420,9 @@ class IdentityDetails(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param type: The type of identity. Possible values include: "None", "SystemAssigned", + :ivar type: The type of identity. Possible values include: "None", "SystemAssigned", "UserAssigned". Default value: "None". - :type type: str or ~storage_import_export.models.IdentityType + :vartype type: str or ~storage_import_export.models.IdentityType :ivar principal_id: Specifies the principal id for the identity for the job. :vartype principal_id: str :ivar tenant_id: Specifies the tenant id for the identity for the job. @@ -354,6 +446,11 @@ def __init__( type: Optional[Union[str, "IdentityType"]] = "None", **kwargs ): + """ + :keyword type: The type of identity. Possible values include: "None", "SystemAssigned", + "UserAssigned". Default value: "None". + :paramtype type: str or ~storage_import_export.models.IdentityType + """ super(IdentityDetails, self).__init__(**kwargs) self.type = type self.principal_id = None @@ -363,54 +460,54 @@ def __init__( class JobDetails(msrest.serialization.Model): """Specifies the job properties. - :param storage_account_id: The resource identifier of the storage account where data will be + :ivar storage_account_id: The resource identifier of the storage account where data will be imported to or exported from. - :type storage_account_id: str - :param job_type: The type of job. - :type job_type: str - :param return_address: Specifies the return address information for the job. - :type return_address: ~storage_import_export.models.ReturnAddress - :param return_shipping: Specifies the return carrier and customer's account with the carrier. - :type return_shipping: ~storage_import_export.models.ReturnShipping - :param shipping_information: Contains information about the Microsoft datacenter to which the + :vartype storage_account_id: str + :ivar job_type: The type of job. + :vartype job_type: str + :ivar return_address: Specifies the return address information for the job. + :vartype return_address: ~storage_import_export.models.ReturnAddress + :ivar return_shipping: Specifies the return carrier and customer's account with the carrier. + :vartype return_shipping: ~storage_import_export.models.ReturnShipping + :ivar shipping_information: Contains information about the Microsoft datacenter to which the drives should be shipped. - :type shipping_information: ~storage_import_export.models.ShippingInformation - :param delivery_package: Contains information about the package being shipped by the customer - to the Microsoft data center. - :type delivery_package: ~storage_import_export.models.DeliveryPackageInformation - :param return_package: Contains information about the package being shipped from the Microsoft + :vartype shipping_information: ~storage_import_export.models.ShippingInformation + :ivar delivery_package: Contains information about the package being shipped by the customer to + the Microsoft data center. + :vartype delivery_package: ~storage_import_export.models.DeliveryPackageInformation + :ivar return_package: Contains information about the package being shipped from the Microsoft data center to the customer to return the drives. The format is the same as the deliveryPackage property above. This property is not included if the drives have not yet been returned. - :type return_package: ~storage_import_export.models.PackageInformation - :param diagnostics_path: The virtual blob directory to which the copy logs and backups of drive + :vartype return_package: ~storage_import_export.models.PackageInformation + :ivar diagnostics_path: The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored. - :type diagnostics_path: str - :param log_level: Default value is Error. Indicates whether error logging or verbose logging + :vartype diagnostics_path: str + :ivar log_level: Default value is Error. Indicates whether error logging or verbose logging will be enabled. - :type log_level: str - :param backup_drive_manifest: Default value is false. Indicates whether the manifest files on + :vartype log_level: str + :ivar backup_drive_manifest: Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs. - :type backup_drive_manifest: bool - :param state: Current state of the job. - :type state: str - :param cancel_requested: Indicates whether a request has been submitted to cancel the job. - :type cancel_requested: bool - :param percent_complete: Overall percentage completed for the job. - :type percent_complete: long - :param incomplete_blob_list_uri: A blob path that points to a block blob containing a list of + :vartype backup_drive_manifest: bool + :ivar state: Current state of the job. + :vartype state: str + :ivar cancel_requested: Indicates whether a request has been submitted to cancel the job. + :vartype cancel_requested: bool + :ivar percent_complete: Overall percentage completed for the job. + :vartype percent_complete: long + :ivar incomplete_blob_list_uri: A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive space. If all blobs were exported successfully, then this element is not included in the response. - :type incomplete_blob_list_uri: str - :param drive_list: List of up to ten drives that comprise the job. The drive list is a required + :vartype incomplete_blob_list_uri: str + :ivar drive_list: List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified for export jobs. - :type drive_list: list[~storage_import_export.models.DriveStatus] - :param export: A property containing information about the blobs to be exported for an export + :vartype drive_list: list[~storage_import_export.models.DriveStatus] + :ivar export: A property containing information about the blobs to be exported for an export job. This property is included for export jobs only. - :type export: ~storage_import_export.models.Export - :param provisioning_state: Specifies the provisioning state of the job. - :type provisioning_state: str - :param encryption_key: Contains information about the encryption key. - :type encryption_key: ~storage_import_export.models.EncryptionKeyDetails + :vartype export: ~storage_import_export.models.Export + :ivar provisioning_state: Specifies the provisioning state of the job. + :vartype provisioning_state: str + :ivar encryption_key: Contains information about the encryption key. + :vartype encryption_key: ~storage_import_export.models.EncryptionKeyDetails """ _attribute_map = { @@ -446,9 +543,9 @@ def __init__( return_package: Optional["PackageInformation"] = None, diagnostics_path: Optional[str] = None, log_level: Optional[str] = None, - backup_drive_manifest: Optional[bool] = None, - state: Optional[str] = None, - cancel_requested: Optional[bool] = None, + backup_drive_manifest: Optional[bool] = False, + state: Optional[str] = "Creating", + cancel_requested: Optional[bool] = False, percent_complete: Optional[int] = None, incomplete_blob_list_uri: Optional[str] = None, drive_list: Optional[List["DriveStatus"]] = None, @@ -457,6 +554,57 @@ def __init__( encryption_key: Optional["EncryptionKeyDetails"] = None, **kwargs ): + """ + :keyword storage_account_id: The resource identifier of the storage account where data will be + imported to or exported from. + :paramtype storage_account_id: str + :keyword job_type: The type of job. + :paramtype job_type: str + :keyword return_address: Specifies the return address information for the job. + :paramtype return_address: ~storage_import_export.models.ReturnAddress + :keyword return_shipping: Specifies the return carrier and customer's account with the carrier. + :paramtype return_shipping: ~storage_import_export.models.ReturnShipping + :keyword shipping_information: Contains information about the Microsoft datacenter to which the + drives should be shipped. + :paramtype shipping_information: ~storage_import_export.models.ShippingInformation + :keyword delivery_package: Contains information about the package being shipped by the customer + to the Microsoft data center. + :paramtype delivery_package: ~storage_import_export.models.DeliveryPackageInformation + :keyword return_package: Contains information about the package being shipped from the + Microsoft data center to the customer to return the drives. The format is the same as the + deliveryPackage property above. This property is not included if the drives have not yet been + returned. + :paramtype return_package: ~storage_import_export.models.PackageInformation + :keyword diagnostics_path: The virtual blob directory to which the copy logs and backups of + drive manifest files (if enabled) will be stored. + :paramtype diagnostics_path: str + :keyword log_level: Default value is Error. Indicates whether error logging or verbose logging + will be enabled. + :paramtype log_level: str + :keyword backup_drive_manifest: Default value is false. Indicates whether the manifest files on + the drives should be copied to block blobs. + :paramtype backup_drive_manifest: bool + :keyword state: Current state of the job. + :paramtype state: str + :keyword cancel_requested: Indicates whether a request has been submitted to cancel the job. + :paramtype cancel_requested: bool + :keyword percent_complete: Overall percentage completed for the job. + :paramtype percent_complete: long + :keyword incomplete_blob_list_uri: A blob path that points to a block blob containing a list of + blob names that were not exported due to insufficient drive space. If all blobs were exported + successfully, then this element is not included in the response. + :paramtype incomplete_blob_list_uri: str + :keyword drive_list: List of up to ten drives that comprise the job. The drive list is a + required element for an import job; it is not specified for export jobs. + :paramtype drive_list: list[~storage_import_export.models.DriveStatus] + :keyword export: A property containing information about the blobs to be exported for an export + job. This property is included for export jobs only. + :paramtype export: ~storage_import_export.models.Export + :keyword provisioning_state: Specifies the provisioning state of the job. + :paramtype provisioning_state: str + :keyword encryption_key: Contains information about the encryption key. + :paramtype encryption_key: ~storage_import_export.models.EncryptionKeyDetails + """ super(JobDetails, self).__init__(**kwargs) self.storage_account_id = storage_account_id self.job_type = job_type @@ -491,14 +639,14 @@ class JobResponse(msrest.serialization.Model): :vartype name: str :ivar type: Specifies the type of the job resource. :vartype type: str - :param location: Specifies the Azure location where the job is created. - :type location: str - :param tags: A set of tags. Specifies the tags that are assigned to the job. - :type tags: any - :param properties: Specifies the job properties. - :type properties: ~storage_import_export.models.JobDetails - :param identity: Specifies the job identity details. - :type identity: ~storage_import_export.models.IdentityDetails + :ivar location: Specifies the Azure location where the job is created. + :vartype location: str + :ivar tags: A set of tags. Specifies the tags that are assigned to the job. + :vartype tags: any + :ivar properties: Specifies the job properties. + :vartype properties: ~storage_import_export.models.JobDetails + :ivar identity: Specifies the job identity details. + :vartype identity: ~storage_import_export.models.IdentityDetails """ _validation = { @@ -528,6 +676,16 @@ def __init__( identity: Optional["IdentityDetails"] = None, **kwargs ): + """ + :keyword location: Specifies the Azure location where the job is created. + :paramtype location: str + :keyword tags: A set of tags. Specifies the tags that are assigned to the job. + :paramtype tags: any + :keyword properties: Specifies the job properties. + :paramtype properties: ~storage_import_export.models.JobDetails + :keyword identity: Specifies the job identity details. + :paramtype identity: ~storage_import_export.models.IdentityDetails + """ super(JobResponse, self).__init__(**kwargs) self.system_data = None self.id = None @@ -542,10 +700,10 @@ def __init__( class ListJobsResponse(msrest.serialization.Model): """List jobs response. - :param next_link: link to next batch of jobs. - :type next_link: str - :param value: Job list. - :type value: list[~storage_import_export.models.JobResponse] + :ivar next_link: link to next batch of jobs. + :vartype next_link: str + :ivar value: Job list. + :vartype value: list[~storage_import_export.models.JobResponse] """ _attribute_map = { @@ -560,6 +718,12 @@ def __init__( value: Optional[List["JobResponse"]] = None, **kwargs ): + """ + :keyword next_link: link to next batch of jobs. + :paramtype next_link: str + :keyword value: Job list. + :paramtype value: list[~storage_import_export.models.JobResponse] + """ super(ListJobsResponse, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -568,8 +732,8 @@ def __init__( class ListOperationsResponse(msrest.serialization.Model): """List operations response. - :param value: operations. - :type value: list[~storage_import_export.models.Operation] + :ivar value: operations. + :vartype value: list[~storage_import_export.models.Operation] """ _attribute_map = { @@ -582,6 +746,10 @@ def __init__( value: Optional[List["Operation"]] = None, **kwargs ): + """ + :keyword value: operations. + :paramtype value: list[~storage_import_export.models.Operation] + """ super(ListOperationsResponse, self).__init__(**kwargs) self.value = value @@ -589,44 +757,44 @@ def __init__( class Location(msrest.serialization.Model): """Provides information about an Azure data center location. - :param id: Specifies the resource identifier of the location. - :type id: str - :param name: Specifies the name of the location. Use List Locations to get all supported + :ivar id: Specifies the resource identifier of the location. + :vartype id: str + :ivar name: Specifies the name of the location. Use List Locations to get all supported locations. - :type name: str - :param type: Specifies the type of the location. - :type type: str - :param recipient_name: The recipient name to use when shipping the drives to the Azure data + :vartype name: str + :ivar type: Specifies the type of the location. + :vartype type: str + :ivar recipient_name: The recipient name to use when shipping the drives to the Azure data center. - :type recipient_name: str - :param street_address1: The first line of the street address to use when shipping the drives to + :vartype recipient_name: str + :ivar street_address1: The first line of the street address to use when shipping the drives to + the Azure data center. + :vartype street_address1: str + :ivar street_address2: The second line of the street address to use when shipping the drives to the Azure data center. - :type street_address1: str - :param street_address2: The second line of the street address to use when shipping the drives - to the Azure data center. - :type street_address2: str - :param city: The city name to use when shipping the drives to the Azure data center. - :type city: str - :param state_or_province: The state or province to use when shipping the drives to the Azure + :vartype street_address2: str + :ivar city: The city name to use when shipping the drives to the Azure data center. + :vartype city: str + :ivar state_or_province: The state or province to use when shipping the drives to the Azure data center. - :type state_or_province: str - :param postal_code: The postal code to use when shipping the drives to the Azure data center. - :type postal_code: str - :param country_or_region: The country or region to use when shipping the drives to the Azure + :vartype state_or_province: str + :ivar postal_code: The postal code to use when shipping the drives to the Azure data center. + :vartype postal_code: str + :ivar country_or_region: The country or region to use when shipping the drives to the Azure data center. - :type country_or_region: str - :param phone: The phone number for the Azure data center. - :type phone: str - :param additional_shipping_information: Additional shipping information for customer, specific + :vartype country_or_region: str + :ivar phone: The phone number for the Azure data center. + :vartype phone: str + :ivar additional_shipping_information: Additional shipping information for customer, specific to datacenter to which customer should send their disks. - :type additional_shipping_information: str - :param supported_carriers: A list of carriers that are supported at this location. - :type supported_carriers: list[str] - :param alternate_locations: A list of location IDs that should be used to ship shipping drives + :vartype additional_shipping_information: str + :ivar supported_carriers: A list of carriers that are supported at this location. + :vartype supported_carriers: list[str] + :ivar alternate_locations: A list of location IDs that should be used to ship shipping drives to for jobs created against the current location. If the current location is active, it will be part of the list. If it is temporarily closed due to maintenance, this list may contain other locations. - :type alternate_locations: list[str] + :vartype alternate_locations: list[str] """ _attribute_map = { @@ -665,6 +833,46 @@ def __init__( alternate_locations: Optional[List[str]] = None, **kwargs ): + """ + :keyword id: Specifies the resource identifier of the location. + :paramtype id: str + :keyword name: Specifies the name of the location. Use List Locations to get all supported + locations. + :paramtype name: str + :keyword type: Specifies the type of the location. + :paramtype type: str + :keyword recipient_name: The recipient name to use when shipping the drives to the Azure data + center. + :paramtype recipient_name: str + :keyword street_address1: The first line of the street address to use when shipping the drives + to the Azure data center. + :paramtype street_address1: str + :keyword street_address2: The second line of the street address to use when shipping the drives + to the Azure data center. + :paramtype street_address2: str + :keyword city: The city name to use when shipping the drives to the Azure data center. + :paramtype city: str + :keyword state_or_province: The state or province to use when shipping the drives to the Azure + data center. + :paramtype state_or_province: str + :keyword postal_code: The postal code to use when shipping the drives to the Azure data center. + :paramtype postal_code: str + :keyword country_or_region: The country or region to use when shipping the drives to the Azure + data center. + :paramtype country_or_region: str + :keyword phone: The phone number for the Azure data center. + :paramtype phone: str + :keyword additional_shipping_information: Additional shipping information for customer, + specific to datacenter to which customer should send their disks. + :paramtype additional_shipping_information: str + :keyword supported_carriers: A list of carriers that are supported at this location. + :paramtype supported_carriers: list[str] + :keyword alternate_locations: A list of location IDs that should be used to ship shipping + drives to for jobs created against the current location. If the current location is active, it + will be part of the list. If it is temporarily closed due to maintenance, this list may contain + other locations. + :paramtype alternate_locations: list[str] + """ super(Location, self).__init__(**kwargs) self.id = id self.name = name @@ -685,8 +893,8 @@ def __init__( class LocationsResponse(msrest.serialization.Model): """Locations response. - :param value: locations. - :type value: list[~storage_import_export.models.Location] + :ivar value: locations. + :vartype value: list[~storage_import_export.models.Location] """ _attribute_map = { @@ -699,6 +907,10 @@ def __init__( value: Optional[List["Location"]] = None, **kwargs ): + """ + :keyword value: locations. + :paramtype value: list[~storage_import_export.models.Location] + """ super(LocationsResponse, self).__init__(**kwargs) self.value = value @@ -708,16 +920,16 @@ class Operation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the operation. - :type name: str - :param provider: The resource provider name to which the operation belongs. - :type provider: str - :param resource: The name of the resource to which the operation belongs. - :type resource: str - :param operation: The display name of the operation. - :type operation: str - :param description: Short description of the operation. - :type description: str + :ivar name: Required. Name of the operation. + :vartype name: str + :ivar provider: The resource provider name to which the operation belongs. + :vartype provider: str + :ivar resource: The name of the resource to which the operation belongs. + :vartype resource: str + :ivar operation: The display name of the operation. + :vartype operation: str + :ivar description: Short description of the operation. + :vartype description: str """ _validation = { @@ -742,6 +954,18 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. Name of the operation. + :paramtype name: str + :keyword provider: The resource provider name to which the operation belongs. + :paramtype provider: str + :keyword resource: The name of the resource to which the operation belongs. + :paramtype resource: str + :keyword operation: The display name of the operation. + :paramtype operation: str + :keyword description: Short description of the operation. + :paramtype description: str + """ super(Operation, self).__init__(**kwargs) self.name = name self.provider = provider @@ -755,15 +979,15 @@ class PackageInformation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param carrier_name: Required. The name of the carrier that is used to ship the import or - export drives. - :type carrier_name: str - :param tracking_number: Required. The tracking number of the package. - :type tracking_number: str - :param drive_count: Required. The number of drives included in the package. - :type drive_count: long - :param ship_date: Required. The date when the package is shipped. - :type ship_date: str + :ivar carrier_name: Required. The name of the carrier that is used to ship the import or export + drives. + :vartype carrier_name: str + :ivar tracking_number: Required. The tracking number of the package. + :vartype tracking_number: str + :ivar drive_count: Required. The number of drives included in the package. + :vartype drive_count: long + :ivar ship_date: Required. The date when the package is shipped. + :vartype ship_date: str """ _validation = { @@ -789,6 +1013,17 @@ def __init__( ship_date: str, **kwargs ): + """ + :keyword carrier_name: Required. The name of the carrier that is used to ship the import or + export drives. + :paramtype carrier_name: str + :keyword tracking_number: Required. The tracking number of the package. + :paramtype tracking_number: str + :keyword drive_count: Required. The number of drives included in the package. + :paramtype drive_count: long + :keyword ship_date: Required. The date when the package is shipped. + :paramtype ship_date: str + """ super(PackageInformation, self).__init__(**kwargs) self.carrier_name = carrier_name self.tracking_number = tracking_number @@ -799,12 +1034,12 @@ def __init__( class PutJobParameters(msrest.serialization.Model): """Put Job parameters. - :param location: Specifies the supported Azure location where the job should be created. - :type location: str - :param tags: A set of tags. Specifies the tags that will be assigned to the job. - :type tags: any - :param properties: Specifies the job properties. - :type properties: ~storage_import_export.models.JobDetails + :ivar location: Specifies the supported Azure location where the job should be created. + :vartype location: str + :ivar tags: A set of tags. Specifies the tags that will be assigned to the job. + :vartype tags: any + :ivar properties: Specifies the job properties. + :vartype properties: ~storage_import_export.models.JobDetails """ _attribute_map = { @@ -821,6 +1056,14 @@ def __init__( properties: Optional["JobDetails"] = None, **kwargs ): + """ + :keyword location: Specifies the supported Azure location where the job should be created. + :paramtype location: str + :keyword tags: A set of tags. Specifies the tags that will be assigned to the job. + :paramtype tags: any + :keyword properties: Specifies the job properties. + :paramtype properties: ~storage_import_export.models.JobDetails + """ super(PutJobParameters, self).__init__(**kwargs) self.location = location self.tags = tags @@ -832,26 +1075,26 @@ class ReturnAddress(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param recipient_name: Required. The name of the recipient who will receive the hard drives - when they are returned. - :type recipient_name: str - :param street_address1: Required. The first line of the street address to use when returning - the drives. - :type street_address1: str - :param street_address2: The second line of the street address to use when returning the drives. - :type street_address2: str - :param city: Required. The city name to use when returning the drives. - :type city: str - :param state_or_province: The state or province to use when returning the drives. - :type state_or_province: str - :param postal_code: Required. The postal code to use when returning the drives. - :type postal_code: str - :param country_or_region: Required. The country or region to use when returning the drives. - :type country_or_region: str - :param phone: Required. Phone number of the recipient of the returned drives. - :type phone: str - :param email: Required. Email address of the recipient of the returned drives. - :type email: str + :ivar recipient_name: Required. The name of the recipient who will receive the hard drives when + they are returned. + :vartype recipient_name: str + :ivar street_address1: Required. The first line of the street address to use when returning the + drives. + :vartype street_address1: str + :ivar street_address2: The second line of the street address to use when returning the drives. + :vartype street_address2: str + :ivar city: Required. The city name to use when returning the drives. + :vartype city: str + :ivar state_or_province: The state or province to use when returning the drives. + :vartype state_or_province: str + :ivar postal_code: Required. The postal code to use when returning the drives. + :vartype postal_code: str + :ivar country_or_region: Required. The country or region to use when returning the drives. + :vartype country_or_region: str + :ivar phone: Required. Phone number of the recipient of the returned drives. + :vartype phone: str + :ivar email: Required. Email address of the recipient of the returned drives. + :vartype email: str """ _validation = { @@ -890,6 +1133,29 @@ def __init__( state_or_province: Optional[str] = None, **kwargs ): + """ + :keyword recipient_name: Required. The name of the recipient who will receive the hard drives + when they are returned. + :paramtype recipient_name: str + :keyword street_address1: Required. The first line of the street address to use when returning + the drives. + :paramtype street_address1: str + :keyword street_address2: The second line of the street address to use when returning the + drives. + :paramtype street_address2: str + :keyword city: Required. The city name to use when returning the drives. + :paramtype city: str + :keyword state_or_province: The state or province to use when returning the drives. + :paramtype state_or_province: str + :keyword postal_code: Required. The postal code to use when returning the drives. + :paramtype postal_code: str + :keyword country_or_region: Required. The country or region to use when returning the drives. + :paramtype country_or_region: str + :keyword phone: Required. Phone number of the recipient of the returned drives. + :paramtype phone: str + :keyword email: Required. Email address of the recipient of the returned drives. + :paramtype email: str + """ super(ReturnAddress, self).__init__(**kwargs) self.recipient_name = recipient_name self.street_address1 = street_address1 @@ -907,10 +1173,10 @@ class ReturnShipping(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param carrier_name: Required. The carrier's name. - :type carrier_name: str - :param carrier_account_number: Required. The customer's account number with the carrier. - :type carrier_account_number: str + :ivar carrier_name: Required. The carrier's name. + :vartype carrier_name: str + :ivar carrier_account_number: Required. The customer's account number with the carrier. + :vartype carrier_account_number: str """ _validation = { @@ -930,6 +1196,12 @@ def __init__( carrier_account_number: str, **kwargs ): + """ + :keyword carrier_name: Required. The carrier's name. + :paramtype carrier_name: str + :keyword carrier_account_number: Required. The customer's account number with the carrier. + :paramtype carrier_account_number: str + """ super(ReturnShipping, self).__init__(**kwargs) self.carrier_name = carrier_name self.carrier_account_number = carrier_account_number @@ -940,23 +1212,23 @@ class ShippingInformation(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param recipient_name: The name of the recipient who will receive the hard drives when they are + :ivar recipient_name: The name of the recipient who will receive the hard drives when they are returned. - :type recipient_name: str - :param street_address1: The first line of the street address to use when returning the drives. - :type street_address1: str - :param street_address2: The second line of the street address to use when returning the drives. - :type street_address2: str - :param city: The city name to use when returning the drives. - :type city: str - :param state_or_province: The state or province to use when returning the drives. - :type state_or_province: str - :param postal_code: The postal code to use when returning the drives. - :type postal_code: str - :param country_or_region: The country or region to use when returning the drives. - :type country_or_region: str - :param phone: Phone number of the recipient of the returned drives. - :type phone: str + :vartype recipient_name: str + :ivar street_address1: The first line of the street address to use when returning the drives. + :vartype street_address1: str + :ivar street_address2: The second line of the street address to use when returning the drives. + :vartype street_address2: str + :ivar city: The city name to use when returning the drives. + :vartype city: str + :ivar state_or_province: The state or province to use when returning the drives. + :vartype state_or_province: str + :ivar postal_code: The postal code to use when returning the drives. + :vartype postal_code: str + :ivar country_or_region: The country or region to use when returning the drives. + :vartype country_or_region: str + :ivar phone: Phone number of the recipient of the returned drives. + :vartype phone: str :ivar additional_information: Additional shipping information for customer, specific to datacenter to which customer should send their disks. :vartype additional_information: str @@ -991,6 +1263,27 @@ def __init__( phone: Optional[str] = None, **kwargs ): + """ + :keyword recipient_name: The name of the recipient who will receive the hard drives when they + are returned. + :paramtype recipient_name: str + :keyword street_address1: The first line of the street address to use when returning the + drives. + :paramtype street_address1: str + :keyword street_address2: The second line of the street address to use when returning the + drives. + :paramtype street_address2: str + :keyword city: The city name to use when returning the drives. + :paramtype city: str + :keyword state_or_province: The state or province to use when returning the drives. + :paramtype state_or_province: str + :keyword postal_code: The postal code to use when returning the drives. + :paramtype postal_code: str + :keyword country_or_region: The country or region to use when returning the drives. + :paramtype country_or_region: str + :keyword phone: Phone number of the recipient of the returned drives. + :paramtype phone: str + """ super(ShippingInformation, self).__init__(**kwargs) self.recipient_name = recipient_name self.street_address1 = street_address1 @@ -1006,20 +1299,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~storage_import_export.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :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 ~storage_import_export.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". - :type last_modified_by_type: str or ~storage_import_export.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~storage_import_export.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -1042,6 +1335,22 @@ def __init__( 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 ~storage_import_export.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 ~storage_import_export.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 @@ -1054,30 +1363,30 @@ def __init__( class UpdateJobParameters(msrest.serialization.Model): """Update Job parameters. - :param tags: A set of tags. Specifies the tags that will be assigned to the job. - :type tags: any - :param cancel_requested: If specified, the value must be true. The service will attempt to + :ivar tags: A set of tags. Specifies the tags that will be assigned to the job. + :vartype tags: any + :ivar cancel_requested: If specified, the value must be true. The service will attempt to cancel the job. - :type cancel_requested: bool - :param state: If specified, the value must be Shipping, which tells the Import/Export service + :vartype cancel_requested: bool + :ivar state: If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been shipped. The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, otherwise the request will fail. - :type state: str - :param return_address: Specifies the return address information for the job. - :type return_address: ~storage_import_export.models.ReturnAddress - :param return_shipping: Specifies the return carrier and customer's account with the carrier. - :type return_shipping: ~storage_import_export.models.ReturnShipping - :param delivery_package: Contains information about the package being shipped by the customer - to the Microsoft data center. - :type delivery_package: ~storage_import_export.models.DeliveryPackageInformation - :param log_level: Indicates whether error logging or verbose logging is enabled. - :type log_level: str - :param backup_drive_manifest: Indicates whether the manifest files on the drives should be + :vartype state: str + :ivar return_address: Specifies the return address information for the job. + :vartype return_address: ~storage_import_export.models.ReturnAddress + :ivar return_shipping: Specifies the return carrier and customer's account with the carrier. + :vartype return_shipping: ~storage_import_export.models.ReturnShipping + :ivar delivery_package: Contains information about the package being shipped by the customer to + the Microsoft data center. + :vartype delivery_package: ~storage_import_export.models.DeliveryPackageInformation + :ivar log_level: Indicates whether error logging or verbose logging is enabled. + :vartype log_level: str + :ivar backup_drive_manifest: Indicates whether the manifest files on the drives should be copied to block blobs. - :type backup_drive_manifest: bool - :param drive_list: List of drives that comprise the job. - :type drive_list: list[~storage_import_export.models.DriveStatus] + :vartype backup_drive_manifest: bool + :ivar drive_list: List of drives that comprise the job. + :vartype drive_list: list[~storage_import_export.models.DriveStatus] """ _attribute_map = { @@ -1096,16 +1405,42 @@ def __init__( self, *, tags: Optional[Any] = None, - cancel_requested: Optional[bool] = None, + cancel_requested: Optional[bool] = False, state: Optional[str] = None, return_address: Optional["ReturnAddress"] = None, return_shipping: Optional["ReturnShipping"] = None, delivery_package: Optional["DeliveryPackageInformation"] = None, log_level: Optional[str] = None, - backup_drive_manifest: Optional[bool] = None, + backup_drive_manifest: Optional[bool] = False, drive_list: Optional[List["DriveStatus"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Specifies the tags that will be assigned to the job. + :paramtype tags: any + :keyword cancel_requested: If specified, the value must be true. The service will attempt to + cancel the job. + :paramtype cancel_requested: bool + :keyword state: If specified, the value must be Shipping, which tells the Import/Export service + that the package for the job has been shipped. The ReturnAddress and DeliveryPackage properties + must have been set either in this request or in a previous request, otherwise the request will + fail. + :paramtype state: str + :keyword return_address: Specifies the return address information for the job. + :paramtype return_address: ~storage_import_export.models.ReturnAddress + :keyword return_shipping: Specifies the return carrier and customer's account with the carrier. + :paramtype return_shipping: ~storage_import_export.models.ReturnShipping + :keyword delivery_package: Contains information about the package being shipped by the customer + to the Microsoft data center. + :paramtype delivery_package: ~storage_import_export.models.DeliveryPackageInformation + :keyword log_level: Indicates whether error logging or verbose logging is enabled. + :paramtype log_level: str + :keyword backup_drive_manifest: Indicates whether the manifest files on the drives should be + copied to block blobs. + :paramtype backup_drive_manifest: bool + :keyword drive_list: List of drives that comprise the job. + :paramtype drive_list: list[~storage_import_export.models.DriveStatus] + """ super(UpdateJobParameters, self).__init__(**kwargs) self.tags = tags self.cancel_requested = cancel_requested diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_storage_import_export_enums.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_storage_import_export_enums.py index 397faf89d4782..f7dbf5c113611 100644 --- a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_storage_import_export_enums.py +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_storage_import_export_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -35,7 +20,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DriveState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DriveState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The drive's current state. """ @@ -47,14 +32,14 @@ class DriveState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMPLETED_MORE_INFO = "CompletedMoreInfo" SHIPPED_BACK = "ShippedBack" -class EncryptionKekType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionKekType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of kek encryption key """ MICROSOFT_MANAGED = "MicrosoftManaged" CUSTOMER_MANAGED = "CustomerManaged" -class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity """ diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_bit_locker_keys_operations.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_bit_locker_keys_operations.py index c422ab190fa36..0dabac35e33ba 100644 --- a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_bit_locker_keys_operations.py +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_bit_locker_keys_operations.py @@ -5,24 +5,72 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + job_name, # type: str + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept_language = kwargs.pop('accept_language', None) # type: Optional[str] + + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}/listBitLockerKeys') + path_format_arguments = { + "jobName": _SERIALIZER.url("job_name", job_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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 accept_language is not None: + header_parameters['Accept-Language'] = _SERIALIZER.header("accept_language", accept_language, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class BitLockerKeysOperations(object): """BitLockerKeysOperations operations. @@ -45,6 +93,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, job_name, # type: str @@ -60,7 +109,8 @@ def list( within the user subscription. :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 GetBitLockerKeysResponse or the result of cls(response) + :return: An iterator like instance of either GetBitLockerKeysResponse or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~storage_import_export.models.GetBitLockerKeysResponse] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -69,38 +119,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.accept_language is not None: - header_parameters['Accept-Language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'jobName': self._serialize.url("job_name", job_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_request( + job_name=job_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + accept_language=self._config.accept_language, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + job_name=job_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + accept_language=self._config.accept_language, + 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('GetBitLockerKeysResponse', pipeline_response) + deserialized = self._deserialize("GetBitLockerKeysResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,12 +160,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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-storageimportexport/azure/mgmt/storageimportexport/operations/_jobs_operations.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_jobs_operations.py index 6555d5aa4e499..aa2a2448d51fb 100644 --- a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_jobs_operations.py +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_jobs_operations.py @@ -5,24 +5,287 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_subscription_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + filter = kwargs.pop('filter', None) # type: Optional[str] + accept_language = kwargs.pop('accept_language', None) # type: Optional[str] + + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ImportExport/jobs') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'long') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if accept_language is not None: + header_parameters['Accept-Language'] = _SERIALIZER.header("accept_language", accept_language, 'str') + 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_resource_group_request( + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + filter = kwargs.pop('filter', None) # type: Optional[str] + accept_language = kwargs.pop('accept_language', None) # type: Optional[str] + + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'long') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if accept_language is not None: + header_parameters['Accept-Language'] = _SERIALIZER.header("accept_language", accept_language, 'str') + 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( + job_name, # type: str + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept_language = kwargs.pop('accept_language', None) # type: Optional[str] + + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}') + path_format_arguments = { + "jobName": _SERIALIZER.url("job_name", job_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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 accept_language is not None: + header_parameters['Accept-Language'] = _SERIALIZER.header("accept_language", accept_language, 'str') + 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( + job_name, # type: str + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + accept_language = kwargs.pop('accept_language', None) # type: Optional[str] + + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}') + path_format_arguments = { + "jobName": _SERIALIZER.url("job_name", job_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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 accept_language is not None: + header_parameters['Accept-Language'] = _SERIALIZER.header("accept_language", accept_language, 'str') + 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, + **kwargs + ) + + +def build_create_request( + job_name, # type: str + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + accept_language = kwargs.pop('accept_language', None) # type: Optional[str] + client_tenant_id = kwargs.pop('client_tenant_id', None) # type: Optional[str] + + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}') + path_format_arguments = { + "jobName": _SERIALIZER.url("job_name", job_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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 accept_language is not None: + header_parameters['Accept-Language'] = _SERIALIZER.header("accept_language", accept_language, 'str') + if client_tenant_id is not None: + header_parameters['x-ms-client-tenant-id'] = _SERIALIZER.header("client_tenant_id", client_tenant_id, 'str') + 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, + **kwargs + ) + + +def build_delete_request( + job_name, # type: str + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept_language = kwargs.pop('accept_language', None) # type: Optional[str] + + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}') + path_format_arguments = { + "jobName": _SERIALIZER.url("job_name", job_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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 accept_language is not None: + header_parameters['Accept-Language'] = _SERIALIZER.header("accept_language", accept_language, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class JobsOperations(object): """JobsOperations operations. @@ -45,6 +308,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, top=None, # type: Optional[int] @@ -69,40 +333,35 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.accept_language is not None: - header_parameters['Accept-Language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'long') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + filter=filter, + accept_language=self._config.accept_language, + 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, + top=top, + filter=filter, + accept_language=self._config.accept_language, + 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('ListJobsResponse', pipeline_response) + deserialized = self._deserialize("ListJobsResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,17 +374,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ImportExport/jobs'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name, # type: str @@ -154,41 +415,37 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.accept_language is not None: - header_parameters['Accept-Language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'long') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + top=top, + filter=filter, + accept_language=self._config.accept_language, + 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, + top=top, + filter=filter, + accept_language=self._config.accept_language, + 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('ListJobsResponse', pipeline_response) + deserialized = self._deserialize("ListJobsResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -201,17 +458,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.ImportExport/jobs'} # type: ignore + @distributed_trace def get( self, job_name, # type: str @@ -236,35 +495,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'jobName': self._serialize.url("job_name", job_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.accept_language is not None: - header_parameters['Accept-Language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + job_name=job_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + accept_language=self._config.accept_language, + 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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -273,8 +521,11 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'} # type: ignore + + @distributed_trace def update( self, job_name, # type: str @@ -304,40 +555,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'jobName': self._serialize.url("job_name", job_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.accept_language is not None: - header_parameters['Accept-Language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'UpdateJobParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'UpdateJobParameters') + + request = build_update_request( + job_name=job_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + accept_language=self._config.accept_language, + template_url=self.update.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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -346,8 +586,11 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'} # type: ignore + + @distributed_trace def create( self, job_name, # type: str @@ -378,42 +621,30 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'jobName': self._serialize.url("job_name", job_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.accept_language is not None: - header_parameters['Accept-Language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') - if client_tenant_id is not None: - header_parameters['x-ms-client-tenant-id'] = self._serialize.header("client_tenant_id", client_tenant_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'PutJobParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'PutJobParameters') + + request = build_create_request( + job_name=job_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + accept_language=self._config.accept_language, + client_tenant_id=client_tenant_id, + template_url=self.create.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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -426,8 +657,11 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'} # type: ignore + + @distributed_trace def delete( self, job_name, # type: str @@ -452,38 +686,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'jobName': self._serialize.url("job_name", job_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.accept_language is not None: - header_parameters['Accept-Language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + job_name=job_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + accept_language=self._config.accept_language, + 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_locations_operations.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_locations_operations.py index 15f211adcfe39..dce66bdb15bfd 100644 --- a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_locations_operations.py +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_locations_operations.py @@ -5,24 +5,98 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept_language = kwargs.pop('accept_language', None) # type: Optional[str] + + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.ImportExport/locations') + + # 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 accept_language is not None: + header_parameters['Accept-Language'] = _SERIALIZER.header("accept_language", accept_language, 'str') + 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( + location_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept_language = kwargs.pop('accept_language', None) # type: Optional[str] + + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.ImportExport/locations/{locationName}') + path_format_arguments = { + "locationName": _SERIALIZER.url("location_name", location_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 accept_language is not None: + header_parameters['Accept-Language'] = _SERIALIZER.header("accept_language", accept_language, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class LocationsOperations(object): """LocationsOperations operations. @@ -45,6 +119,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -63,32 +138,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.accept_language is not None: - header_parameters['Accept-Language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') - 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( + accept_language=self._config.accept_language, + 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( + accept_language=self._config.accept_language, + 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('LocationsResponse', pipeline_response) + deserialized = self._deserialize("LocationsResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,17 +173,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/providers/Microsoft.ImportExport/locations'} # type: ignore + @distributed_trace def get( self, location_name, # type: str @@ -133,33 +207,22 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'locationName': self._serialize.url("location_name", location_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] - if self._config.accept_language is not None: - header_parameters['Accept-Language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + location_name=location_name, + accept_language=self._config.accept_language, + 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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Location', pipeline_response) @@ -168,4 +231,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/providers/Microsoft.ImportExport/locations/{locationName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_operations.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_operations.py index 8675e33b65ce1..ebb3fb7d805ba 100644 --- a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_operations.py @@ -5,24 +5,62 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept_language = kwargs.pop('accept_language', None) # type: Optional[str] + + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.ImportExport/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] + if accept_language is not None: + header_parameters['Accept-Language'] = _SERIALIZER.header("accept_language", accept_language, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +83,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,7 +92,8 @@ def list( """Returns the list of operations supported by the import/export resource provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListOperationsResponse or the result of cls(response) + :return: An iterator like instance of either ListOperationsResponse or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~storage_import_export.models.ListOperationsResponse] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -62,32 +102,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.accept_language is not None: - header_parameters['Accept-Language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') - 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( + accept_language=self._config.accept_language, + 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( + accept_language=self._config.accept_language, + 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('ListOperationsResponse', pipeline_response) + deserialized = self._deserialize("ListOperationsResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -100,12 +137,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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/_meta.json b/sdk/storage/azure-mgmt-storagesync/_meta.json index 118b09547900e..de6af21bf3c2e 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": "2ab4371edba33c23e8d680ed2bf6f98705b5cadb", "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 --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 ab897e67abbf1..67e510c0757c5 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 cca075a91e7c1..3448e24c1e188 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_configuration.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +68,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 36d5a7c7db394..9939477bdff07 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 ac8ce46c988a6..be16d97466f96 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,24 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 azure.core.rest import HttpRequest, HttpResponse -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 +31,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 +52,65 @@ 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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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 0000000000000..74e48ecd07cf3 --- /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 0000000000000..138f663c53a4e --- /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 c47f66669f1bf..e5754a47ce68f 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 39f85d7fea657..04c6eb9ff13bd 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 957ea3aa5c028..093beb85446c5 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 a1ccac388fd93..a7bbb44e815c5 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 0000000000000..74e48ecd07cf3 --- /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 85ce9379c268e..6498106a813ee 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 29bbd5b3f0b73..38501a3b7c1a3 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 0000000000000..ab307c86bdfbb --- /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 766180d609eb4..255a424b7873e 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 05219f72b2bb7..bcb8f8321e811 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 fb7a4db315dcb..9e250ff5865ce 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 fa7418f3bcdb5..21463e2408c60 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 22e0ef2f08688..1e4a5d0fef229 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 cd0a36ab3a294..06cdbfa62507a 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 2dbaf232cd016..a3c2acab6fb48 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 34246f413920d..061221542cafe 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 556af5ef9f30c..0fb297a1dc38c 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 78d2687ac751c..e66b169de7dca 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 @@ -12,13 +12,17 @@ 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 @@ -80,13 +84,17 @@ from ._models import CheckNameAvailabilityResult # type: ignore from ._models import CloudEndpoint # type: ignore from ._models import CloudEndpointArray # type: ignore + from ._models import CloudEndpointChangeEnumerationActivity # type: ignore + from ._models import CloudEndpointChangeEnumerationStatus # type: ignore from ._models import CloudEndpointCreateParameters # type: ignore + from ._models import CloudEndpointLastChangeEnumerationStatus # 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 LocationOperationStatus # type: ignore from ._models import OperationDisplayInfo # type: ignore from ._models import OperationDisplayResource # type: ignore from ._models import OperationEntity # type: ignore @@ -145,9 +153,12 @@ from ._microsoft_storage_sync_enums import ( ChangeDetectionMode, + CloudEndpointChangeEnumerationActivityState, + CloudEndpointChangeEnumerationTotalCountsState, FeatureStatus, IncomingTrafficPolicy, InitialDownloadPolicy, + InitialUploadPolicy, LocalCacheMode, NameAvailabilityReason, OperationDirection, @@ -169,13 +180,17 @@ 'CheckNameAvailabilityResult', 'CloudEndpoint', 'CloudEndpointArray', + 'CloudEndpointChangeEnumerationActivity', + 'CloudEndpointChangeEnumerationStatus', 'CloudEndpointCreateParameters', + 'CloudEndpointLastChangeEnumerationStatus', 'CloudTieringCachePerformance', 'CloudTieringDatePolicyStatus', 'CloudTieringFilesNotTiering', 'CloudTieringSpaceSavings', 'CloudTieringVolumeFreeSpacePolicyStatus', 'FilesNotTieringError', + 'LocationOperationStatus', 'OperationDisplayInfo', 'OperationDisplayResource', 'OperationEntity', @@ -232,9 +247,12 @@ 'Workflow', 'WorkflowArray', 'ChangeDetectionMode', + 'CloudEndpointChangeEnumerationActivityState', + 'CloudEndpointChangeEnumerationTotalCountsState', '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 3a002f71150f7..7f29392aafba0 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,47 @@ # 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 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 +54,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 +77,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 +85,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 +94,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 +102,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 +112,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 +122,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 +131,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 +139,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 +148,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 +156,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 +166,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 index 0dbfd9dba1aa0..de6cae09cb941 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_models.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_models.py @@ -13,8 +13,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 = { @@ -25,6 +25,10 @@ def __init__( self, **kwargs ): + """ + :keyword azure_file_share: Azure File Share. + :paramtype azure_file_share: str + """ super(BackupRequest, self).__init__(**kwargs) self.azure_file_share = kwargs.get('azure_file_share', None) @@ -36,11 +40,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 """ @@ -60,6 +63,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The name to check for availability. + :paramtype name: str + """ super(CheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -97,6 +104,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -134,6 +143,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -171,6 +182,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -187,24 +200,27 @@ 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 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 = { @@ -212,6 +228,7 @@ class CloudEndpoint(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'backup_enabled': {'readonly': True}, + 'change_enumeration_status': {'readonly': True}, } _attribute_map = { @@ -227,12 +244,31 @@ 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__( self, **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 = kwargs.get('storage_account_resource_id', None) self.azure_file_share_name = kwargs.get('azure_file_share_name', None) @@ -243,13 +279,14 @@ def __init__( 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) + 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 = { @@ -260,10 +297,145 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of CloudEndpoint. + :paramtype value: list[~azure.mgmt.storagesync.models.CloudEndpoint] + """ super(CloudEndpointArray, self).__init__(**kwargs) self.value = kwargs.get('value', None) +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. @@ -277,14 +449,14 @@ 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 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 = { @@ -307,6 +479,16 @@ def __init__( self, **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 = kwargs.get('storage_account_resource_id', None) self.azure_file_share_name = kwargs.get('azure_file_share_name', None) @@ -314,6 +496,58 @@ def __init__( self.friendly_name = kwargs.get('friendly_name', None) +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. @@ -348,6 +582,8 @@ def __init__( self, **kwargs ): + """ + """ super(CloudTieringCachePerformance, self).__init__(**kwargs) self.last_updated_timestamp = None self.cache_hit_bytes = None @@ -380,6 +616,8 @@ def __init__( self, **kwargs ): + """ + """ super(CloudTieringDatePolicyStatus, self).__init__(**kwargs) self.last_updated_timestamp = None self.tiered_files_most_recent_access_timestamp = None @@ -414,6 +652,8 @@ def __init__( self, **kwargs ): + """ + """ super(CloudTieringFilesNotTiering, self).__init__(**kwargs) self.last_updated_timestamp = None self.total_file_count = None @@ -461,6 +701,8 @@ def __init__( self, **kwargs ): + """ + """ super(CloudTieringSpaceSavings, self).__init__(**kwargs) self.last_updated_timestamp = None self.volume_size_bytes = None @@ -500,6 +742,8 @@ def __init__( self, **kwargs ): + """ + """ super(CloudTieringVolumeFreeSpacePolicyStatus, self).__init__(**kwargs) self.last_updated_timestamp = None self.effective_volume_free_space_policy = None @@ -531,22 +775,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 = { @@ -560,6 +863,16 @@ def __init__( self, **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 = kwargs.get('description', None) self.operation = kwargs.get('operation', None) @@ -570,14 +883,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 = { @@ -591,6 +904,16 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -601,14 +924,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 = { @@ -622,6 +945,16 @@ def __init__( self, **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 = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -632,10 +965,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 = { @@ -647,6 +980,12 @@ def __init__( self, **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 = kwargs.get('next_link', None) self.value = kwargs.get('value', None) @@ -655,8 +994,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 """ @@ -668,6 +1007,11 @@ def __init__( self, **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 = kwargs.get('service_specification', None) @@ -675,20 +1019,20 @@ 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 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] """ @@ -706,6 +1050,23 @@ def __init__( self, **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 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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -719,12 +1080,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 = { @@ -737,6 +1098,14 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -746,8 +1115,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] """ @@ -759,6 +1128,11 @@ def __init__( self, **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 = kwargs.get('metric_specifications', None) @@ -800,6 +1174,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationStatus, self).__init__(**kwargs) self.name = None self.status = None @@ -829,6 +1205,8 @@ def __init__( self, **kwargs ): + """ + """ super(PostBackupResponse, self).__init__(**kwargs) self.cloud_endpoint_name = None @@ -836,22 +1214,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 = { @@ -869,6 +1247,24 @@ def __init__( self, **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 = kwargs.get('partition', None) self.replica_group = kwargs.get('replica_group', None) @@ -883,25 +1279,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 = { @@ -920,6 +1316,27 @@ def __init__( self, **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 = kwargs.get('partition', None) self.replica_group = kwargs.get('replica_group', None) @@ -953,6 +1370,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -970,11 +1389,11 @@ 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 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". @@ -1002,6 +1421,14 @@ def __init__( self, **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 = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) @@ -1011,8 +1438,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 = { @@ -1023,6 +1450,10 @@ def __init__( self, **kwargs ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.storagesync.models.PrivateEndpointConnection] + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) @@ -1044,8 +1475,8 @@ class PrivateLinkResource(Resource): :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 = { @@ -1069,6 +1500,10 @@ def __init__( self, **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 @@ -1078,8 +1513,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 = { @@ -1090,6 +1525,10 @@ def __init__( self, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.storagesync.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) @@ -1097,14 +1536,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 = { @@ -1117,6 +1556,16 @@ def __init__( self, **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 = kwargs.get('status', None) self.description = kwargs.get('description', None) @@ -1126,10 +1575,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 = { @@ -1141,6 +1590,12 @@ def __init__( self, **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 = kwargs.get('pattern', None) self.recall_path = kwargs.get('recall_path', None) @@ -1159,32 +1614,32 @@ 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 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. @@ -1197,8 +1652,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. @@ -1215,18 +1670,6 @@ class RegisteredServer(ProxyResource): '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}, } @@ -1240,7 +1683,7 @@ class RegisteredServer(ProxyResource): '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'}, @@ -1263,37 +1706,79 @@ def __init__( self, **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 = 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_management_error_code = kwargs.get('server_management_error_code', None) + self.last_heart_beat = kwargs.get('last_heart_beat', None) + self.provisioning_state = kwargs.get('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.storage_sync_service_uid = kwargs.get('storage_sync_service_uid', None) + self.last_workflow_id = kwargs.get('last_workflow_id', None) + self.last_operation_name = kwargs.get('last_operation_name', None) + self.discovery_endpoint_uri = kwargs.get('discovery_endpoint_uri', None) + self.resource_location = kwargs.get('resource_location', None) + self.service_location = kwargs.get('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.management_endpoint_uri = kwargs.get('management_endpoint_uri', None) + self.monitoring_endpoint_uri = kwargs.get('monitoring_endpoint_uri', None) + self.monitoring_configuration = kwargs.get('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] + :ivar value: Collection of Registered Server. + :vartype value: list[~azure.mgmt.storagesync.models.RegisteredServer] """ _attribute_map = { @@ -1304,6 +1789,10 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of Registered Server. + :paramtype value: list[~azure.mgmt.storagesync.models.RegisteredServer] + """ super(RegisteredServerArray, self).__init__(**kwargs) self.value = kwargs.get('value', None) @@ -1321,24 +1810,24 @@ 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 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 = { @@ -1366,6 +1855,26 @@ def __init__( self, **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 = kwargs.get('server_certificate', None) self.agent_version = kwargs.get('agent_version', None) @@ -1381,10 +1890,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 = { @@ -1396,6 +1905,12 @@ def __init__( self, **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 = kwargs.get('target_resource_group', None) self.resources = kwargs.get('resources', None) @@ -1404,10 +1919,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 = { @@ -1419,6 +1934,12 @@ def __init__( self, **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 = kwargs.get('path', None) self.isdir = kwargs.get('isdir', None) @@ -1437,19 +1958,19 @@ 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 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. @@ -1458,27 +1979,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 """ @@ -1522,6 +2046,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'}, } @@ -1529,6 +2054,36 @@ def __init__( self, **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 = kwargs.get('server_local_path', None) self.cloud_tiering = kwargs.get('cloud_tiering', None) @@ -1548,14 +2103,15 @@ def __init__( 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.initial_upload_policy = kwargs.get('initial_upload_policy', 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] + :ivar value: Collection of ServerEndpoint. + :vartype value: list[~azure.mgmt.storagesync.models.ServerEndpoint] """ _attribute_map = { @@ -1566,6 +2122,10 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of ServerEndpoint. + :paramtype value: list[~azure.mgmt.storagesync.models.ServerEndpoint] + """ super(ServerEndpointArray, self).__init__(**kwargs) self.value = kwargs.get('value', None) @@ -1577,6 +2137,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. @@ -1585,12 +2147,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'}, } @@ -1599,8 +2163,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 @@ -1665,6 +2232,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerEndpointCloudTieringStatus, self).__init__(**kwargs) self.last_updated_timestamp = None self.health = None @@ -1691,30 +2260,33 @@ 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 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 = { @@ -1739,16 +2311,47 @@ 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'}, - } - - def __init__( - self, - **kwargs - ): + 'initial_upload_policy': {'key': 'properties.initialUploadPolicy', 'type': 'str'}, + } + + def __init__( + self, + **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 = 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.volume_free_space_percent = kwargs.get('volume_free_space_percent', 20) 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) @@ -1756,6 +2359,7 @@ def __init__( 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) + self.initial_upload_policy = kwargs.get('initial_upload_policy', None) class ServerEndpointFilesNotSyncingError(msrest.serialization.Model): @@ -1787,6 +2391,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerEndpointFilesNotSyncingError, self).__init__(**kwargs) self.error_code = None self.persistent_count = None @@ -1818,6 +2424,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerEndpointRecallError, self).__init__(**kwargs) self.error_code = None self.count = None @@ -1852,6 +2460,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerEndpointRecallStatus, self).__init__(**kwargs) self.last_updated_timestamp = None self.total_recall_errors_count = None @@ -1878,6 +2488,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 = { @@ -1888,6 +2500,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 = { @@ -1898,12 +2511,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 @@ -1912,6 +2528,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): @@ -1965,6 +2582,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerEndpointSyncSessionStatus, self).__init__(**kwargs) self.last_sync_result = None self.last_sync_timestamp = None @@ -2049,6 +2668,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerEndpointSyncStatus, self).__init__(**kwargs) self.download_health = None self.upload_health = None @@ -2067,21 +2688,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 = { @@ -2102,6 +2723,23 @@ def __init__( self, **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 = kwargs.get('cloud_tiering', None) self.volume_free_space_percent = kwargs.get('volume_free_space_percent', None) @@ -2114,16 +2752,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 inner_error: Inner error details of the given entry. + :vartype inner_error: ~azure.mgmt.storagesync.models.StorageSyncInnerErrorDetails """ _attribute_map = { @@ -2138,6 +2776,18 @@ def __init__( self, **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 inner_error: Inner error details of the given entry. + :paramtype inner_error: ~azure.mgmt.storagesync.models.StorageSyncInnerErrorDetails + """ super(StorageSyncApiError, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -2149,10 +2799,10 @@ def __init__( 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 = { @@ -2164,6 +2814,12 @@ def __init__( self, **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 = kwargs.get('error', None) self.innererror = kwargs.get('innererror', None) @@ -2172,22 +2828,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 = { @@ -2205,6 +2861,24 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -2219,14 +2893,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 = { @@ -2240,6 +2914,16 @@ def __init__( self, **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 = kwargs.get('call_stack', None) self.message = kwargs.get('message', None) @@ -2262,10 +2946,10 @@ 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 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 = { @@ -2287,6 +2971,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.location = kwargs['location'] @@ -2307,13 +2997,13 @@ 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 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. @@ -2362,6 +3052,15 @@ def __init__( self, **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__(**kwargs) self.incoming_traffic_policy = kwargs.get('incoming_traffic_policy', None) self.storage_sync_service_status = None @@ -2375,8 +3074,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 = { @@ -2387,6 +3086,10 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of StorageSyncServices. + :paramtype value: list[~azure.mgmt.storagesync.models.StorageSyncService] + """ super(StorageSyncServiceArray, self).__init__(**kwargs) self.value = kwargs.get('value', None) @@ -2396,19 +3099,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 = { @@ -2425,6 +3128,21 @@ def __init__( self, **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 = kwargs['location'] self.tags = kwargs.get('tags', None) @@ -2434,11 +3152,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 = { @@ -2450,6 +3168,13 @@ def __init__( self, **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 = kwargs.get('tags', None) self.incoming_traffic_policy = kwargs.get('incoming_traffic_policy', None) @@ -2460,13 +3185,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 = { @@ -2483,6 +3208,13 @@ def __init__( self, **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 = kwargs.get('state', None) self.istransitioning = None @@ -2528,6 +3260,8 @@ def __init__( self, **kwargs ): + """ + """ super(SyncGroup, self).__init__(**kwargs) self.unique_id = None self.sync_group_status = None @@ -2536,8 +3270,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 = { @@ -2548,6 +3282,10 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of SyncGroup. + :paramtype value: list[~azure.mgmt.storagesync.models.SyncGroup] + """ super(SyncGroupArray, self).__init__(**kwargs) self.value = kwargs.get('value', None) @@ -2565,8 +3303,8 @@ 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 properties: The parameters used to create the sync group. + :vartype properties: any """ _validation = { @@ -2586,6 +3324,10 @@ def __init__( self, **kwargs ): + """ + :keyword properties: The parameters used to create the sync group. + :paramtype properties: any + """ super(SyncGroupCreateParameters, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) @@ -2593,15 +3335,15 @@ def __init__( 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 = { @@ -2614,6 +3356,17 @@ def __init__( self, **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 = kwargs.get('directory_path', None) self.change_detection_mode = kwargs.get('change_detection_mode', None) @@ -2623,8 +3376,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 = { @@ -2635,6 +3388,10 @@ def __init__( self, **kwargs ): + """ + :keyword server_certificate: Certificate Data. + :paramtype server_certificate: str + """ super(TriggerRolloverRequest, self).__init__(**kwargs) self.server_certificate = kwargs.get('server_certificate', None) @@ -2675,11 +3432,6 @@ 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}, 'command_name': {'readonly': True}, 'created_timestamp': {'readonly': True}, 'last_status_timestamp': {'readonly': True}, @@ -2703,12 +3455,25 @@ def __init__( self, **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 = kwargs.get('last_step_name', None) + self.status = kwargs.get('status', None) + self.operation = kwargs.get('operation', None) + self.steps = kwargs.get('steps', None) + self.last_operation_id = kwargs.get('last_operation_id', None) self.command_name = None self.created_timestamp = None self.last_status_timestamp = None @@ -2717,8 +3482,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 = { @@ -2729,5 +3494,9 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of workflow items. + :paramtype value: list[~azure.mgmt.storagesync.models.Workflow] + """ 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 37514c302f295..b067ff2b691a2 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,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError import msrest.serialization @@ -17,8 +17,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 +31,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 +46,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 +71,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 +112,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -142,6 +151,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -179,6 +190,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -195,24 +208,27 @@ 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 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 = { @@ -220,6 +236,7 @@ class CloudEndpoint(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'backup_enabled': {'readonly': True}, + 'change_enumeration_status': {'readonly': True}, } _attribute_map = { @@ -235,6 +252,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 +268,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 +296,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 +316,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,14 +468,14 @@ 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 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 = { @@ -331,6 +503,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 +520,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 +606,8 @@ def __init__( self, **kwargs ): + """ + """ super(CloudTieringCachePerformance, self).__init__(**kwargs) self.last_updated_timestamp = None self.cache_hit_bytes = None @@ -404,6 +640,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 +676,8 @@ def __init__( self, **kwargs ): + """ + """ super(CloudTieringFilesNotTiering, self).__init__(**kwargs) self.last_updated_timestamp = None self.total_file_count = None @@ -485,6 +725,8 @@ def __init__( self, **kwargs ): + """ + """ super(CloudTieringSpaceSavings, self).__init__(**kwargs) self.last_updated_timestamp = None self.volume_size_bytes = None @@ -524,6 +766,8 @@ def __init__( self, **kwargs ): + """ + """ super(CloudTieringVolumeFreeSpacePolicyStatus, self).__init__(**kwargs) self.last_updated_timestamp = None self.effective_volume_free_space_policy = None @@ -555,22 +799,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 +892,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 +912,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 +938,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 +958,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 +984,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 +1004,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 +1022,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 +1036,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 +1051,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 +1063,20 @@ 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 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] """ @@ -758,6 +1102,23 @@ def __init__( 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 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 @@ -771,12 +1132,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 +1154,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 +1171,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 +1186,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 +1232,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationStatus, self).__init__(**kwargs) self.name = None self.status = None @@ -887,6 +1263,8 @@ def __init__( self, **kwargs ): + """ + """ super(PostBackupResponse, self).__init__(**kwargs) self.cloud_endpoint_name = None @@ -894,22 +1272,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 +1314,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 +1346,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 +1393,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 +1447,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -1047,11 +1466,11 @@ 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 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". @@ -1082,6 +1501,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 +1518,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 +1532,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 @@ -1126,8 +1557,8 @@ class PrivateLinkResource(Resource): :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 = { @@ -1153,6 +1584,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 +1597,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 +1611,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 +1622,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 +1646,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 +1665,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 +1683,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 +1707,32 @@ 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 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 +1745,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. @@ -1308,18 +1763,6 @@ class RegisteredServer(ProxyResource): '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}, } @@ -1333,7 +1776,7 @@ class RegisteredServer(ProxyResource): '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 +1801,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 +1905,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,24 +1926,24 @@ 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 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 = { @@ -1480,6 +1981,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 +2016,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 +2034,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 +2048,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 +2066,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 +2090,19 @@ 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 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 +2111,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 """ @@ -1642,6 +2178,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 +2195,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 +2247,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 +2268,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 +2283,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 +2293,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 +2309,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 +2378,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerEndpointCloudTieringStatus, self).__init__(**kwargs) self.last_updated_timestamp = None self.health = None @@ -1824,30 +2406,33 @@ 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 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 = { @@ -1872,6 +2457,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,7 +2465,7 @@ def __init__( *, server_local_path: Optional[str] = None, cloud_tiering: Optional[Union[str, "FeatureStatus"]] = None, - volume_free_space_percent: Optional[int] = None, + volume_free_space_percent: Optional[int] = 20, tier_files_older_than_days: Optional[int] = None, friendly_name: Optional[str] = None, server_resource_id: Optional[str] = None, @@ -1887,8 +2473,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(ServerEndpointCreateParameters, self).__init__(**kwargs) self.server_local_path = server_local_path self.cloud_tiering = cloud_tiering @@ -1900,6 +2517,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 +2549,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerEndpointFilesNotSyncingError, self).__init__(**kwargs) self.error_code = None self.persistent_count = None @@ -1962,6 +2582,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerEndpointRecallError, self).__init__(**kwargs) self.error_code = None self.count = None @@ -1996,6 +2618,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerEndpointRecallStatus, self).__init__(**kwargs) self.last_updated_timestamp = None self.total_recall_errors_count = None @@ -2022,6 +2646,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 +2658,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 +2669,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 +2686,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 +2740,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerEndpointSyncSessionStatus, self).__init__(**kwargs) self.last_sync_result = None self.last_sync_timestamp = None @@ -2193,6 +2826,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerEndpointSyncStatus, self).__init__(**kwargs) self.download_health = None self.upload_health = None @@ -2211,21 +2846,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 +2888,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 +2917,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 inner_error: Inner error details of the given entry. + :vartype inner_error: ~azure.mgmt.storagesync.models.StorageSyncInnerErrorDetails """ _attribute_map = { @@ -2295,6 +2947,18 @@ def __init__( inner_error: 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 inner_error: Inner error details of the given entry. + :paramtype inner_error: ~azure.mgmt.storagesync.models.StorageSyncInnerErrorDetails + """ super(StorageSyncApiError, self).__init__(**kwargs) self.code = code self.message = message @@ -2306,10 +2970,10 @@ def __init__( 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 +2988,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 +3002,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 +3044,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 +3076,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 +3102,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,10 +3134,10 @@ 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 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 = { @@ -2464,6 +3162,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 +3188,13 @@ 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 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. @@ -2543,6 +3247,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 +3269,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 +3283,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 +3296,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 +3329,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 +3353,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 +3372,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 +3389,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 +3412,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 @@ -2721,6 +3467,8 @@ def __init__( self, **kwargs ): + """ + """ super(SyncGroup, self).__init__(**kwargs) self.unique_id = None self.sync_group_status = None @@ -2729,8 +3477,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 +3491,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,8 +3512,8 @@ 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 properties: The parameters used to create the sync group. + :vartype properties: any """ _validation = { @@ -2780,9 +3532,13 @@ class SyncGroupCreateParameters(ProxyResource): 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 @@ -2790,15 +3546,15 @@ def __init__( 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 +3571,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 +3591,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 +3605,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 @@ -2878,11 +3649,6 @@ 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}, 'command_name': {'readonly': True}, 'created_timestamp': {'readonly': True}, 'last_status_timestamp': {'readonly': True}, @@ -2904,14 +3670,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 +3705,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 +3719,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 85ce9379c268e..6498106a813ee 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 73ad716cfc579..05983bb2a97c6 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,26 +5,456 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request_initial( + subscription_id, # type: str + 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: (...) -> 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, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + 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: (...) -> 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, # type: str + 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: (...) -> 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, # type: str + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + 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: (...) -> 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, + **kwargs + ) + + +def build_post_backup_request_initial( + subscription_id, # type: str + 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: (...) -> 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, + **kwargs + ) + + +def build_pre_restore_request_initial( + subscription_id, # type: str + 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: (...) -> 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, + **kwargs + ) + + +def build_restoreheartbeat_request( + subscription_id, # type: str + 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: (...) -> 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, # type: str + 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: (...) -> 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, + **kwargs + ) + + +def build_trigger_change_detection_request_initial( + subscription_id, # type: str + 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: (...) -> 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, + **kwargs + ) + +# fmt: on class CloudEndpointsOperations(object): """CloudEndpointsOperations operations. @@ -62,47 +492,37 @@ def _create_initial( 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 = 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,13 +531,17 @@ 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 @@ -142,15 +566,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 +592,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,8 +622,10 @@ 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 @@ -233,48 +655,41 @@ 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 @@ -289,41 +704,31 @@ def _delete_initial( 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,12 +736,15 @@ 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 @@ -358,15 +766,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 +792,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,8 +811,10 @@ 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 @@ -438,37 +841,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 +882,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 ) @@ -507,58 +909,51 @@ def _pre_backup_initial( 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 @@ -583,15 +978,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 +1003,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,6 +1026,7 @@ 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( @@ -653,61 +1044,55 @@ def _post_backup_initial( 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 @@ -732,15 +1117,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 +1143,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 +1155,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,6 +1174,7 @@ 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( @@ -810,53 +1192,45 @@ def _pre_restore_initial( 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 @@ -881,15 +1255,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 +1280,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,8 +1303,10 @@ 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 @@ -965,46 +1336,38 @@ 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 @@ -1020,53 +1383,45 @@ def _post_restore_initial( 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 = 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 @@ -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,6 +1494,7 @@ 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( @@ -1161,53 +1512,45 @@ def _trigger_change_detection_initial( 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 @@ -1233,15 +1576,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 +1601,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 +1624,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 0000000000000..f6a1b0a75d439 --- /dev/null +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_microsoft_storage_sync_operations.py @@ -0,0 +1,126 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import TYPE_CHECKING +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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_location_operation_status_request( + subscription_id, # type: str + location_name, # type: str + operation_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on +class MicrosoftStorageSyncOperationsMixin(object): + + @distributed_trace + def location_operation_status( + self, + location_name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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 9570efb48cc98..723f923e234b2 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,23 +5,71 @@ # 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 TYPE_CHECKING 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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + location_name, # type: str + workflow_id, # type: str + operation_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class OperationStatusOperations(object): """OperationStatusOperations operations. @@ -44,6 +92,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -73,44 +122,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 56933c8f386d6..aab0ea89b28b4 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,24 +5,58 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,7 +88,8 @@ def list( """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 +98,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 +131,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 8c5c63c598609..517795ec5988b 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,26 +5,188 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + storage_sync_service_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + storage_sync_service_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name, # type: str + storage_sync_service_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + storage_sync_service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -47,6 +209,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -75,34 +238,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,8 +264,10 @@ 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 @@ -127,43 +282,32 @@ def _create_initial( 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,13 +317,17 @@ 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 @@ -204,15 +352,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 +377,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,6 +403,7 @@ 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( @@ -273,35 +419,24 @@ def _delete_initial( 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,12 +445,15 @@ 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 @@ -336,15 +474,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 +499,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,8 +518,10 @@ 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 @@ -402,8 +536,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 +547,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 +586,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 28a2bdf103009..cfcf2a295ace9 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,23 +5,67 @@ # 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 TYPE_CHECKING 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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_storage_sync_service_request( + resource_group_name, # type: str + storage_sync_service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -44,6 +88,7 @@ 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 @@ -68,27 +113,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') - # 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,4 +137,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 8d69040974535..4af78442236bf 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,26 +5,230 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_storage_sync_service_request( + subscription_id, # type: str + resource_group_name, # type: str + storage_sync_service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + storage_sync_service_name, # type: str + server_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + storage_sync_service_name, # type: str + server_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + storage_sync_service_name, # type: str + server_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + storage_sync_service_name, # type: str + server_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class RegisteredServersOperations(object): """RegisteredServersOperations operations. @@ -47,6 +251,7 @@ 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 @@ -61,7 +266,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 +276,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,17 +315,19 @@ 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 @@ -149,47 +354,40 @@ 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 @@ -204,46 +402,36 @@ def _create_initial( 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,13 +439,17 @@ 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 @@ -279,15 +471,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 +496,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,6 +526,7 @@ 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( @@ -352,51 +542,44 @@ def _delete_initial( 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 @@ -415,15 +598,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 +623,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,6 +642,7 @@ 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( @@ -481,56 +659,49 @@ def _trigger_rollover_initial( 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 @@ -552,15 +723,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 +747,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 +770,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 32cd79267ddb8..b946946c3dd77 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,26 +5,284 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request_initial( + subscription_id, # type: str + 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: (...) -> 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, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + 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: (...) -> 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, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + 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: (...) -> 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, # type: str + 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: (...) -> 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, # type: str + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + 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: (...) -> 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, + **kwargs + ) + +# fmt: on class ServerEndpointsOperations(object): """ServerEndpointsOperations operations. @@ -62,47 +320,37 @@ def _create_initial( 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 = 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,13 +358,17 @@ 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 @@ -141,15 +393,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 +419,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,6 +449,7 @@ 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( @@ -218,50 +467,40 @@ def _update_initial( 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,13 +508,17 @@ 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 @@ -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,8 +599,10 @@ 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 @@ -391,48 +632,41 @@ 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 @@ -447,52 +681,45 @@ def _delete_initial( 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 @@ -514,15 +741,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 +767,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,8 +786,10 @@ 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 @@ -594,37 +816,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 +857,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 ) @@ -663,57 +884,50 @@ def _recall_action_initial( 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 @@ -738,15 +952,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 +977,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 +1000,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 fad2c652c3307..a0e6b9f402c0f 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,26 +5,290 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_name_availability_request( + location_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + storage_sync_service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + storage_sync_service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + storage_sync_service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + storage_sync_service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class StorageSyncServicesOperations(object): """StorageSyncServicesOperations operations. @@ -47,6 +311,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, location_name, # type: str @@ -70,31 +335,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] - # 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -108,8 +363,10 @@ 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 @@ -123,42 +380,31 @@ def _create_initial( 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,13 +414,17 @@ 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 @@ -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,8 +493,10 @@ 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 @@ -270,46 +520,39 @@ 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 @@ -323,48 +566,38 @@ def _update_initial( 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,13 +606,17 @@ 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 @@ -398,15 +635,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 +659,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,6 +689,7 @@ 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( @@ -468,39 +704,29 @@ def _delete_initial( 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,12 +734,15 @@ 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 @@ -529,15 +758,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 +782,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,8 +801,10 @@ 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 @@ -590,7 +816,8 @@ def list_by_resource_group( :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 +826,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,17 +863,19 @@ 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 @@ -659,7 +884,8 @@ def list_by_subscription( """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 +894,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 +929,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 2747ab44058a9..e079b6d34ff74 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,24 +5,186 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_storage_sync_service_request( + subscription_id, # type: str + resource_group_name, # type: str + storage_sync_service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class SyncGroupsOperations(object): """SyncGroupsOperations operations. @@ -45,6 +207,7 @@ 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 @@ -68,36 +231,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,17 +270,19 @@ 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 @@ -150,52 +312,46 @@ 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 = 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 @@ -222,47 +378,41 @@ 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 @@ -289,42 +439,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 0a90d5cbecc65..48d7c1c7f5a08 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,24 +5,144 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_storage_sync_service_request( + subscription_id, # type: str + resource_group_name, # type: str + storage_sync_service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + storage_sync_service_name, # type: str + workflow_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + storage_sync_service_name, # type: str + workflow_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class WorkflowsOperations(object): """WorkflowsOperations operations. @@ -45,6 +165,7 @@ 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 @@ -68,36 +189,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,17 +228,19 @@ 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 @@ -147,47 +267,41 @@ 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 @@ -214,41 +328,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 +