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 558d892a8211..d8654ac91282 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 @@ -16,6 +16,7 @@ from .operations import Operations from .operations import SkusOperations from .operations import UsageModelsOperations +from .operations import AscOperations from .operations import CachesOperations from .operations import StorageTargetsOperations from . import models @@ -33,6 +34,8 @@ class StorageCacheManagementClient(SDKClient): :vartype skus: azure.mgmt.storagecache.operations.SkusOperations :ivar usage_models: UsageModels operations :vartype usage_models: azure.mgmt.storagecache.operations.UsageModelsOperations + :ivar asc_operations: AscOperations operations + :vartype asc_operations: azure.mgmt.storagecache.operations.AscOperations :ivar caches: Caches operations :vartype caches: azure.mgmt.storagecache.operations.CachesOperations :ivar storage_targets: StorageTargets operations @@ -65,6 +68,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.usage_models = UsageModelsOperations( self._client, self.config, self._serialize, self._deserialize) + self.asc_operations = AscOperations( + self._client, self.config, self._serialize, self._deserialize) self.caches = CachesOperations( self._client, self.config, self._serialize, self._deserialize) self.storage_targets = StorageTargetsOperations( diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/models/__init__.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/models/__init__.py index 6c3ac0b04921..a2168b00f9f5 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/models/__init__.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/models/__init__.py @@ -12,6 +12,7 @@ try: from ._models_py3 import ApiOperation from ._models_py3 import ApiOperationDisplay + from ._models_py3 import AscOperation from ._models_py3 import Cache from ._models_py3 import CacheEncryptionSettings from ._models_py3 import CacheHealth @@ -23,6 +24,7 @@ from ._models_py3 import ClfsTarget from ._models_py3 import ClfsTargetProperties from ._models_py3 import CloudErrorBody + from ._models_py3 import ErrorResponse from ._models_py3 import KeyVaultKeyReference from ._models_py3 import KeyVaultKeyReferenceSourceVault from ._models_py3 import NamespaceJunction @@ -42,6 +44,7 @@ except (SyntaxError, ImportError): from ._models import ApiOperation from ._models import ApiOperationDisplay + from ._models import AscOperation from ._models import Cache from ._models import CacheEncryptionSettings from ._models import CacheHealth @@ -53,6 +56,7 @@ from ._models import ClfsTarget from ._models import ClfsTargetProperties from ._models import CloudErrorBody + from ._models import ErrorResponse from ._models import KeyVaultKeyReference from ._models import KeyVaultKeyReferenceSourceVault from ._models import NamespaceJunction @@ -86,6 +90,7 @@ __all__ = [ 'ApiOperation', 'ApiOperationDisplay', + 'AscOperation', 'Cache', 'CacheEncryptionSettings', 'CacheHealth', @@ -97,6 +102,7 @@ 'ClfsTarget', 'ClfsTargetProperties', 'CloudErrorBody', + 'ErrorResponse', 'KeyVaultKeyReference', 'KeyVaultKeyReferenceSourceVault', 'NamespaceJunction', 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 bad52904c4f0..abb0466f10ba 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 @@ -58,6 +58,42 @@ def __init__(self, **kwargs): self.resource = kwargs.get('resource', None) +class AscOperation(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: ~azure.mgmt.storagecache.models.ErrorResponse + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'str'}, + 'end_time': {'key': 'endTime', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, **kwargs): + super(AscOperation, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.start_time = kwargs.get('start_time', None) + self.end_time = kwargs.get('end_time', None) + self.status = kwargs.get('status', None) + self.error = kwargs.get('error', None) + + class Cache(Model): """A Cache instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md. @@ -519,6 +555,26 @@ def __init__(self, **kwargs): self.target = kwargs.get('target', None) +class ErrorResponse(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 + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + class KeyVaultKeyReference(Model): """Describes a reference to Key Vault Key. 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 9ee016d95557..75bfa19ed616 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 @@ -58,6 +58,42 @@ def __init__(self, *, operation: str=None, provider: str=None, resource: str=Non self.resource = resource +class AscOperation(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: ~azure.mgmt.storagecache.models.ErrorResponse + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'str'}, + 'end_time': {'key': 'endTime', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, *, id: str=None, name: str=None, start_time: str=None, end_time: str=None, status: str=None, error=None, **kwargs) -> None: + super(AscOperation, self).__init__(**kwargs) + self.id = id + self.name = name + self.start_time = start_time + self.end_time = end_time + self.status = status + self.error = error + + class Cache(Model): """A Cache instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md. @@ -519,6 +555,26 @@ def __init__(self, *, code: str=None, details=None, message: str=None, target: s self.target = target +class ErrorResponse(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 + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + class KeyVaultKeyReference(Model): """Describes a reference to Key Vault Key. diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/__init__.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/__init__.py index a172beeaba23..ef03e08ed00f 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/__init__.py @@ -12,6 +12,7 @@ from ._operations import Operations from ._skus_operations import SkusOperations from ._usage_models_operations import UsageModelsOperations +from ._asc_operations import AscOperations from ._caches_operations import CachesOperations from ._storage_targets_operations import StorageTargetsOperations @@ -19,6 +20,7 @@ 'Operations', 'SkusOperations', 'UsageModelsOperations', + 'AscOperations', 'CachesOperations', 'StorageTargetsOperations', ] diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_asc_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_asc_operations.py new file mode 100644 index 000000000000..02c82b800b8f --- /dev/null +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_asc_operations.py @@ -0,0 +1,102 @@ +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class AscOperations(object): + """AscOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client API version. Constant value: "2020-03-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-03-01" + + self.config = config + + def get( + self, location, operation_id, custom_headers=None, raw=False, **operation_config): + """Gets the status of an asynchronous operation for the Azure HPC cache. + + :param location: The region name which the operation will lookup into. + :type location: str + :param operation_id: The operation id which uniquely identifies the + asynchronous operation. + :type operation_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AscOperation or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.storagecache.models.AscOperation or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AscOperation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/ascOperations/{operationId}'}