From 3f846b1209879fc71e5f0b0b97134a52ca26dcfc Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 28 Jul 2021 13:34:19 +0000 Subject: [PATCH 1/2] CodeGen from PR 14545 in Azure/azure-rest-api-specs [Hub Generated] Review request for Microsoft.StorageCache to add version stable/2021-05-01 (#14545) * Adds base for updating Microsoft.StorageCache from version stable/2021-03-01 to version 2021-05-01 * Updates readme * Updates API version in new specs and examples * 2021-05-01 API Changes * prettier fix * Lintdiff fix * Add create only fields * Create only tag for CacheIdentity * Create only tag for CacheIdentity * Remove create only for key rotation * Fix s360 errors * Fix read only * Revert package-lock.json * Revert package-lock.json --- .../azure-mgmt-storagecache/_meta.json | 11 +- .../azure/mgmt/storagecache/_configuration.py | 2 +- .../azure/mgmt/storagecache/_metadata.json | 7 +- .../_storage_cache_management_client.py | 5 + .../mgmt/storagecache/aio/_configuration.py | 2 +- .../aio/_storage_cache_management_client.py | 5 + .../storagecache/aio/operations/__init__.py | 2 + .../operations/_asc_operations_operations.py | 4 +- .../aio/operations/_caches_operations.py | 86 ++-- .../aio/operations/_operations.py | 4 +- .../aio/operations/_skus_operations.py | 4 +- .../operations/_storage_target_operations.py | 393 +++++++++++++++++ .../operations/_storage_targets_operations.py | 46 +- .../operations/_usage_models_operations.py | 4 +- .../mgmt/storagecache/models/__init__.py | 3 + .../azure/mgmt/storagecache/models/_models.py | 80 +++- .../mgmt/storagecache/models/_models_py3.py | 89 +++- .../_storage_cache_management_client_enums.py | 2 + .../mgmt/storagecache/operations/__init__.py | 2 + .../operations/_asc_operations_operations.py | 2 +- .../operations/_caches_operations.py | 50 +-- .../storagecache/operations/_operations.py | 2 +- .../operations/_skus_operations.py | 2 +- .../operations/_storage_target_operations.py | 403 ++++++++++++++++++ .../operations/_storage_targets_operations.py | 30 +- .../operations/_usage_models_operations.py | 2 +- 26 files changed, 1084 insertions(+), 158 deletions(-) create mode 100644 sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_target_operations.py create mode 100644 sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_target_operations.py diff --git a/sdk/storage/azure-mgmt-storagecache/_meta.json b/sdk/storage/azure-mgmt-storagecache/_meta.json index 7c72dd44fb6f..c37484bfca5f 100644 --- a/sdk/storage/azure-mgmt-storagecache/_meta.json +++ b/sdk/storage/azure-mgmt-storagecache/_meta.json @@ -1,8 +1,11 @@ { - "autorest": "3.3.0", - "use": "@autorest/python@5.6.6", - "commit": "e7411b54a07fdf737ac2d5557401e3a9c7e7a3fe", + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "2b4fc08199d3789162b806c70eb25f09a40fc55c", "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.6.6 --version=3.3.0", + "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", "readme": "specification/storagecache/resource-manager/readme.md" } \ No newline at end of file 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 b624f9f4bff2..3ca81c110784 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_configuration.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_configuration.py @@ -48,7 +48,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-03-01" + self.api_version = "2021-05-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-storagecache/{}'.format(VERSION)) self._configure(**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 08fe16765ba3..71101721ceab 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_metadata.json +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_metadata.json @@ -1,6 +1,6 @@ { - "chosen_version": "2021-03-01", - "total_api_version_list": ["2021-03-01"], + "chosen_version": "2021-05-01", + "total_api_version_list": ["2021-05-01"], "client": { "name": "StorageCacheManagementClient", "filename": "_storage_cache_management_client", @@ -103,6 +103,7 @@ "usage_models": "UsageModelsOperations", "asc_operations": "AscOperationsOperations", "caches": "CachesOperations", - "storage_targets": "StorageTargetsOperations" + "storage_targets": "StorageTargetsOperations", + "storage_target": "StorageTargetOperations" } } \ 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 f9a5293d99db..27e399f3e310 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 @@ -25,6 +25,7 @@ from .operations import AscOperationsOperations from .operations import CachesOperations from .operations import StorageTargetsOperations +from .operations import StorageTargetOperations from . import models @@ -43,6 +44,8 @@ class StorageCacheManagementClient(object): :vartype caches: storage_cache_management_client.operations.CachesOperations :ivar storage_targets: StorageTargetsOperations operations :vartype storage_targets: storage_cache_management_client.operations.StorageTargetsOperations + :ivar storage_target: StorageTargetOperations operations + :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. @@ -81,6 +84,8 @@ def __init__( 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 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 522980713410..bc374598b35e 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 @@ -45,7 +45,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-03-01" + self.api_version = "2021-05-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-storagecache/{}'.format(VERSION)) self._configure(**kwargs) 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 9a0567e21119..5ecd23ba3ad7 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 @@ -23,6 +23,7 @@ from .operations import AscOperationsOperations from .operations import CachesOperations from .operations import StorageTargetsOperations +from .operations import StorageTargetOperations from .. import models @@ -41,6 +42,8 @@ class StorageCacheManagementClient(object): :vartype caches: storage_cache_management_client.aio.operations.CachesOperations :ivar storage_targets: StorageTargetsOperations operations :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. @@ -78,6 +81,8 @@ def __init__( 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: """Runs the network request through the client's chained policies. diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/__init__.py index e3d6678db37e..f20bf4cd94a1 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/__init__.py @@ -12,6 +12,7 @@ from ._asc_operations_operations import AscOperationsOperations from ._caches_operations import CachesOperations from ._storage_targets_operations import StorageTargetsOperations +from ._storage_target_operations import StorageTargetOperations __all__ = [ 'Operations', @@ -20,4 +21,5 @@ 'AscOperationsOperations', 'CachesOperations', 'StorageTargetsOperations', + 'StorageTargetOperations', ] 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 57a2101654dd..613186842266 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 @@ -44,7 +44,7 @@ async def get( self, location: str, operation_id: str, - **kwargs + **kwargs: Any ) -> "_models.AscOperation": """Gets the status of an asynchronous operation for the Azure HPC Cache. @@ -62,7 +62,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL 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 02e34cf1b51c..163bdd470ec6 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 @@ -45,7 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.CachesListResult"]: """Returns all Caches the user has access to under a subscription. @@ -59,7 +59,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" def prepare_request(next_link=None): @@ -112,7 +112,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.CachesListResult"]: """Returns all Caches the user has access to under a resource group. @@ -128,7 +128,7 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" def prepare_request(next_link=None): @@ -183,14 +183,14 @@ async def _delete_initial( self, resource_group_name: str, cache_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 = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL @@ -227,7 +227,7 @@ async def begin_delete( self, resource_group_name: str, cache_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Schedules a Cache for deletion. @@ -238,8 +238,8 @@ 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: 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 None or the result of cls(response) @@ -292,7 +292,7 @@ async def get( self, resource_group_name: str, cache_name: str, - **kwargs + **kwargs: Any ) -> "_models.Cache": """Returns a Cache. @@ -311,7 +311,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL @@ -352,14 +352,14 @@ async def _create_or_update_initial( resource_group_name: str, cache_name: str, cache: Optional["_models.Cache"] = None, - **kwargs + **kwargs: Any ) -> Optional["_models.Cache"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Cache"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -413,7 +413,7 @@ async def begin_create_or_update( resource_group_name: str, cache_name: str, cache: Optional["_models.Cache"] = None, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Cache"]: """Create or update a Cache. @@ -427,8 +427,8 @@ 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: 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 Cache or the result of cls(response) @@ -486,7 +486,7 @@ async def update( resource_group_name: str, cache_name: str, cache: Optional["_models.Cache"] = None, - **kwargs + **kwargs: Any ) -> "_models.Cache": """Update a Cache instance. @@ -508,7 +508,7 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -556,14 +556,14 @@ async def _debug_info_initial( self, resource_group_name: str, cache_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 = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL @@ -600,7 +600,7 @@ async def begin_debug_info( self, resource_group_name: str, cache_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Tells a Cache to write generate debug info for support to process. @@ -611,8 +611,8 @@ 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: 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 None or the result of cls(response) @@ -665,14 +665,14 @@ async def _flush_initial( self, resource_group_name: str, cache_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 = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL @@ -709,7 +709,7 @@ async def begin_flush( self, resource_group_name: str, cache_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors returned until the flush is complete. @@ -721,8 +721,8 @@ 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: 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 None or the result of cls(response) @@ -775,14 +775,14 @@ async def _start_initial( self, resource_group_name: str, cache_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 = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL @@ -819,7 +819,7 @@ async def begin_start( self, resource_group_name: str, cache_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Tells a Stopped state Cache to transition to Active state. @@ -830,8 +830,8 @@ 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: 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 None or the result of cls(response) @@ -884,14 +884,14 @@ async def _stop_initial( self, resource_group_name: str, cache_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 = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL @@ -928,7 +928,7 @@ async def begin_stop( self, resource_group_name: str, cache_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Tells an Active Cache to transition to Stopped state. @@ -939,8 +939,8 @@ 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: 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 None or the result of cls(response) @@ -993,14 +993,14 @@ async def _upgrade_firmware_initial( self, resource_group_name: str, cache_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 = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL @@ -1037,7 +1037,7 @@ async def begin_upgrade_firmware( self, resource_group_name: str, cache_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. @@ -1049,8 +1049,8 @@ 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: 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 None or the result of cls(response) 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 e967a1813df9..485b4c408294 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 @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ApiOperationListResult"]: """Lists all of the available Resource Provider operations. @@ -57,7 +57,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" def prepare_request(next_link=None): 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 6e6e4a4acbf6..363855cb4fff 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 @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ResourceSkusResult"]: """Get the list of StorageCache.Cache SKUs available to this subscription. @@ -57,7 +57,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" def prepare_request(next_link=None): 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 new file mode 100644 index 000000000000..057dbb9cf0be --- /dev/null +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_target_operations.py @@ -0,0 +1,393 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class StorageTargetOperations: + """StorageTargetOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~storage_cache_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _flush_initial( + self, + resource_group_name: str, + cache_name: str, + storage_target_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-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 = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _flush_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/flush'} # type: ignore + + async def begin_flush( + self, + resource_group_name: str, + cache_name: str, + storage_target_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Tells the cache to write all dirty data to the Storage Target's backend storage. Client + requests to this storage target's namespace will return errors until the flush operation + completes. + + :param resource_group_name: Target resource group. + :type resource_group_name: str + :param cache_name: Name of Cache. Length of name must not be greater than 80 and chars must be + from the [-0-9a-zA-Z_] char class. + :type cache_name: str + :param storage_target_name: Name of Storage Target. + :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. + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._flush_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + storage_target_name=storage_target_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_flush.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/flush'} # type: ignore + + async def _suspend_initial( + self, + resource_group_name: str, + cache_name: str, + storage_target_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-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 = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _suspend_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/suspend'} # type: ignore + + async def begin_suspend( + self, + resource_group_name: str, + cache_name: str, + storage_target_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Suspends client access to a storage target. + + :param resource_group_name: Target resource group. + :type resource_group_name: str + :param cache_name: Name of Cache. Length of name must not be greater than 80 and chars must be + from the [-0-9a-zA-Z_] char class. + :type cache_name: str + :param storage_target_name: Name of Storage Target. + :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. + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._suspend_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + storage_target_name=storage_target_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_suspend.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/suspend'} # type: ignore + + async def _resume_initial( + self, + resource_group_name: str, + cache_name: str, + storage_target_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-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 = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _resume_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/resume'} # type: ignore + + async def begin_resume( + self, + resource_group_name: str, + cache_name: str, + storage_target_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Resumes client access to a previously suspended storage target. + + :param resource_group_name: Target resource group. + :type resource_group_name: str + :param cache_name: Name of Cache. Length of name must not be greater than 80 and chars must be + from the [-0-9a-zA-Z_] char class. + :type cache_name: str + :param storage_target_name: Name of Storage Target. + :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. + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._resume_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + storage_target_name=storage_target_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_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 bd1e542da677..73d3dd229661 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 @@ -48,14 +48,14 @@ async def _dns_refresh_initial( resource_group_name: str, cache_name: str, storage_target_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 = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL @@ -94,7 +94,7 @@ async def begin_dns_refresh( resource_group_name: str, cache_name: str, storage_target_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Tells a storage target to refresh its DNS information. @@ -107,8 +107,8 @@ 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: 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 None or the result of cls(response) @@ -163,7 +163,7 @@ def list_by_cache( self, resource_group_name: str, cache_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.StorageTargetsResult"]: """Returns a list of Storage Targets for the specified Cache. @@ -182,7 +182,7 @@ def list_by_cache( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" def prepare_request(next_link=None): @@ -239,14 +239,15 @@ async def _delete_initial( resource_group_name: str, cache_name: str, storage_target_name: str, - **kwargs + force: Optional[str] = None, + **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 = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL @@ -262,6 +263,8 @@ async def _delete_initial( # 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] @@ -285,7 +288,8 @@ async def begin_delete( resource_group_name: str, cache_name: str, storage_target_name: str, - **kwargs + force: Optional[str] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache @@ -299,10 +303,13 @@ async def begin_delete( :type cache_name: str :param storage_target_name: Name of Storage Target. :type storage_target_name: str + :param force: Boolean value requesting the force delete operation for a storage target. Force + delete discards unwritten-data in the cache instead of flushing it to back-end storage. + :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: 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 None or the result of cls(response) @@ -321,6 +328,7 @@ async def begin_delete( resource_group_name=resource_group_name, cache_name=cache_name, storage_target_name=storage_target_name, + force=force, cls=lambda x,y,z: x, **kwargs ) @@ -358,7 +366,7 @@ async def get( resource_group_name: str, cache_name: str, storage_target_name: str, - **kwargs + **kwargs: Any ) -> "_models.StorageTarget": """Returns a Storage Target from a Cache. @@ -379,7 +387,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL @@ -422,14 +430,14 @@ async def _create_or_update_initial( cache_name: str, storage_target_name: str, storagetarget: Optional["_models.StorageTarget"] = None, - **kwargs + **kwargs: Any ) -> Optional["_models.StorageTarget"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageTarget"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -485,7 +493,7 @@ async def begin_create_or_update( cache_name: str, storage_target_name: str, storagetarget: Optional["_models.StorageTarget"] = None, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.StorageTarget"]: """Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until @@ -502,8 +510,8 @@ 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: 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 StorageTarget or the result of cls(response) 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 9680c2e2f290..3e0cdb216f32 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 @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.UsageModelsResult"]: """Get the list of Cache Usage Models available to this subscription. @@ -57,7 +57,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" def prepare_request(next_link=None): 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 d83002557bee..c856720acfe1 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 @@ -52,6 +52,7 @@ from ._models_py3 import UsageModel from ._models_py3 import UsageModelDisplay from ._models_py3 import UsageModelsResult + from ._models_py3 import UserAssignedIdentitiesValue except (SyntaxError, ImportError): from ._models import ApiOperation # type: ignore from ._models import ApiOperationDisplay # type: ignore @@ -98,6 +99,7 @@ from ._models import UsageModel # type: ignore from ._models import UsageModelDisplay # type: ignore from ._models import UsageModelsResult # type: ignore + from ._models import UserAssignedIdentitiesValue # type: ignore from ._storage_cache_management_client_enums import ( CacheIdentityType, @@ -161,6 +163,7 @@ 'UsageModel', 'UsageModelDisplay', 'UsageModelsResult', + 'UserAssignedIdentitiesValue', 'CacheIdentityType', 'CreatedByType', 'DomainJoinedType', 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 ac20566ae320..255ff8704011 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 @@ -136,7 +136,7 @@ class AscOperation(msrest.serialization.Model): :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, str] + :type output: dict[str, any] """ _attribute_map = { @@ -146,7 +146,7 @@ class AscOperation(msrest.serialization.Model): 'end_time': {'key': 'endTime', 'type': 'str'}, 'status': {'key': 'status', 'type': 'str'}, 'error': {'key': 'error', 'type': 'ErrorResponse'}, - 'output': {'key': 'properties.output', 'type': '{str}'}, + 'output': {'key': 'properties.output', 'type': '{object}'}, } def __init__( @@ -213,15 +213,16 @@ class Cache(msrest.serialization.Model): :vartype health: ~storage_cache_management_client.models.CacheHealth :ivar mount_addresses: Array of IP addresses that can be used by clients mounting this Cache. :vartype mount_addresses: list[str] - :param provisioning_state: ARM provisioning state, see + :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". - :type provisioning_state: str or ~storage_cache_management_client.models.ProvisioningStateType + :vartype provisioning_state: str or + ~storage_cache_management_client.models.ProvisioningStateType :param subnet: Subnet used for the Cache. :type subnet: str - :param upgrade_status: Upgrade status of the Cache. - :type upgrade_status: ~storage_cache_management_client.models.CacheUpgradeStatus + :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. @@ -240,6 +241,8 @@ class Cache(msrest.serialization.Model): 'system_data': {'readonly': True}, 'health': {'readonly': True}, 'mount_addresses': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'upgrade_status': {'readonly': True}, } _attribute_map = { @@ -279,9 +282,9 @@ def __init__( self.cache_size_gb = kwargs.get('cache_size_gb', None) self.health = None self.mount_addresses = None - self.provisioning_state = kwargs.get('provisioning_state', None) + self.provisioning_state = None self.subnet = kwargs.get('subnet', None) - self.upgrade_status = kwargs.get('upgrade_status', None) + self.upgrade_status = None self.network_settings = kwargs.get('network_settings', None) self.encryption_settings = kwargs.get('encryption_settings', None) self.security_settings = kwargs.get('security_settings', None) @@ -412,10 +415,14 @@ class CacheEncryptionSettings(msrest.serialization.Model): :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 + rotate to the newest version of the key in the Key Vault. + :type rotation_to_latest_key_version_enabled: bool """ _attribute_map = { 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultKeyReference'}, + 'rotation_to_latest_key_version_enabled': {'key': 'rotationToLatestKeyVersionEnabled', 'type': 'bool'}, } def __init__( @@ -424,6 +431,7 @@ def __init__( ): 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) class CacheHealth(msrest.serialization.Model): @@ -465,13 +473,17 @@ class CacheIdentity(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar principal_id: The principal id of the cache. + :ivar principal_id: The principal ID for the system-assigned identity of the cache. :vartype principal_id: str - :ivar tenant_id: The tenant id associated with the cache. + :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", "None". + "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 + resource ID, and each key's value is an empty dictionary. + :type user_assigned_identities: dict[str, + ~storage_cache_management_client.models.UserAssignedIdentitiesValue] """ _validation = { @@ -483,6 +495,7 @@ class CacheIdentity(msrest.serialization.Model): 'principal_id': {'key': 'principalId', 'type': 'str'}, 'tenant_id': {'key': 'tenantId', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentitiesValue}'}, } def __init__( @@ -493,6 +506,7 @@ def __init__( self.principal_id = None self.tenant_id = None self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) class CacheNetworkSettings(msrest.serialization.Model): @@ -536,7 +550,7 @@ def __init__( self.utility_addresses = None self.dns_servers = kwargs.get('dns_servers', None) self.dns_search_domain = kwargs.get('dns_search_domain', None) - self.ntp_server = kwargs.get('ntp_server', None) + self.ntp_server = kwargs.get('ntp_server', "time.windows.com") class CacheSecuritySettings(msrest.serialization.Model): @@ -1017,7 +1031,7 @@ def __init__( self.namespace_path = kwargs.get('namespace_path', None) self.target_path = kwargs.get('target_path', None) self.nfs_export = kwargs.get('nfs_export', None) - self.nfs_access_policy = kwargs.get('nfs_access_policy', None) + self.nfs_access_policy = kwargs.get('nfs_access_policy', "default") class Nfs3Target(msrest.serialization.Model): @@ -1030,7 +1044,7 @@ class Nfs3Target(msrest.serialization.Model): """ _validation = { - 'target': {'pattern': r'^[-.0-9a-zA-Z]+$'}, + 'target': {'pattern': r'^[-.,0-9a-zA-Z]+$'}, } _attribute_map = { @@ -1370,11 +1384,12 @@ class StorageTarget(StorageTargetResource): :param 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 - :param provisioning_state: ARM provisioning state, see + :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". - :type provisioning_state: str or ~storage_cache_management_client.models.ProvisioningStateType + :vartype provisioning_state: str or + ~storage_cache_management_client.models.ProvisioningStateType :param nfs3: Properties when targetType is nfs3. :type nfs3: ~storage_cache_management_client.models.Nfs3Target :param clfs: Properties when targetType is clfs. @@ -1391,6 +1406,7 @@ class StorageTarget(StorageTargetResource): 'type': {'readonly': True}, 'location': {'readonly': True}, 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { @@ -1415,7 +1431,7 @@ def __init__( super(StorageTarget, self).__init__(**kwargs) self.junctions = kwargs.get('junctions', None) self.target_type = kwargs.get('target_type', None) - self.provisioning_state = kwargs.get('provisioning_state', None) + self.provisioning_state = None self.nfs3 = kwargs.get('nfs3', None) self.clfs = kwargs.get('clfs', None) self.unknown = kwargs.get('unknown', None) @@ -1574,3 +1590,33 @@ def __init__( super(UsageModelsResult, self).__init__(**kwargs) self.next_link = kwargs.get('next_link', None) self.value = kwargs.get('value', None) + + +class UserAssignedIdentitiesValue(msrest.serialization.Model): + """UserAssignedIdentitiesValue. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the user-assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the user-assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + 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 ab0a813b61b7..63846c20a1db 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 @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, Union import msrest.serialization @@ -157,7 +157,7 @@ class AscOperation(msrest.serialization.Model): :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, str] + :type output: dict[str, any] """ _attribute_map = { @@ -167,7 +167,7 @@ class AscOperation(msrest.serialization.Model): 'end_time': {'key': 'endTime', 'type': 'str'}, 'status': {'key': 'status', 'type': 'str'}, 'error': {'key': 'error', 'type': 'ErrorResponse'}, - 'output': {'key': 'properties.output', 'type': '{str}'}, + 'output': {'key': 'properties.output', 'type': '{object}'}, } def __init__( @@ -179,7 +179,7 @@ def __init__( end_time: Optional[str] = None, status: Optional[str] = None, error: Optional["ErrorResponse"] = None, - output: Optional[Dict[str, str]] = None, + output: Optional[Dict[str, Any]] = None, **kwargs ): super(AscOperation, self).__init__(**kwargs) @@ -245,15 +245,16 @@ class Cache(msrest.serialization.Model): :vartype health: ~storage_cache_management_client.models.CacheHealth :ivar mount_addresses: Array of IP addresses that can be used by clients mounting this Cache. :vartype mount_addresses: list[str] - :param provisioning_state: ARM provisioning state, see + :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". - :type provisioning_state: str or ~storage_cache_management_client.models.ProvisioningStateType + :vartype provisioning_state: str or + ~storage_cache_management_client.models.ProvisioningStateType :param subnet: Subnet used for the Cache. :type subnet: str - :param upgrade_status: Upgrade status of the Cache. - :type upgrade_status: ~storage_cache_management_client.models.CacheUpgradeStatus + :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. @@ -272,6 +273,8 @@ class Cache(msrest.serialization.Model): 'system_data': {'readonly': True}, 'health': {'readonly': True}, 'mount_addresses': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'upgrade_status': {'readonly': True}, } _attribute_map = { @@ -303,9 +306,7 @@ def __init__( identity: Optional["CacheIdentity"] = None, sku: Optional["CacheSku"] = None, cache_size_gb: Optional[int] = None, - provisioning_state: Optional[Union[str, "ProvisioningStateType"]] = None, subnet: Optional[str] = None, - upgrade_status: Optional["CacheUpgradeStatus"] = None, network_settings: Optional["CacheNetworkSettings"] = None, encryption_settings: Optional["CacheEncryptionSettings"] = None, security_settings: Optional["CacheSecuritySettings"] = None, @@ -324,9 +325,9 @@ def __init__( self.cache_size_gb = cache_size_gb self.health = None self.mount_addresses = None - self.provisioning_state = provisioning_state + self.provisioning_state = None self.subnet = subnet - self.upgrade_status = upgrade_status + self.upgrade_status = None self.network_settings = network_settings self.encryption_settings = encryption_settings self.security_settings = security_settings @@ -470,20 +471,26 @@ class CacheEncryptionSettings(msrest.serialization.Model): :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 + rotate to the newest version of the key in the Key Vault. + :type rotation_to_latest_key_version_enabled: bool """ _attribute_map = { 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultKeyReference'}, + 'rotation_to_latest_key_version_enabled': {'key': 'rotationToLatestKeyVersionEnabled', 'type': 'bool'}, } def __init__( self, *, key_encryption_key: Optional["KeyVaultKeyReference"] = None, + rotation_to_latest_key_version_enabled: Optional[bool] = None, **kwargs ): 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 class CacheHealth(msrest.serialization.Model): @@ -528,13 +535,17 @@ class CacheIdentity(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar principal_id: The principal id of the cache. + :ivar principal_id: The principal ID for the system-assigned identity of the cache. :vartype principal_id: str - :ivar tenant_id: The tenant id associated with the cache. + :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", "None". + "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 + resource ID, and each key's value is an empty dictionary. + :type user_assigned_identities: dict[str, + ~storage_cache_management_client.models.UserAssignedIdentitiesValue] """ _validation = { @@ -546,18 +557,21 @@ class CacheIdentity(msrest.serialization.Model): 'principal_id': {'key': 'principalId', 'type': 'str'}, 'tenant_id': {'key': 'tenantId', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentitiesValue}'}, } def __init__( self, *, type: Optional[Union[str, "CacheIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "UserAssignedIdentitiesValue"]] = None, **kwargs ): super(CacheIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type + self.user_assigned_identities = user_assigned_identities class CacheNetworkSettings(msrest.serialization.Model): @@ -598,7 +612,7 @@ def __init__( mtu: Optional[int] = 1500, dns_servers: Optional[List[str]] = None, dns_search_domain: Optional[str] = None, - ntp_server: Optional[str] = None, + ntp_server: Optional[str] = "time.windows.com", **kwargs ): super(CacheNetworkSettings, self).__init__(**kwargs) @@ -1136,7 +1150,7 @@ def __init__( namespace_path: Optional[str] = None, target_path: Optional[str] = None, nfs_export: Optional[str] = None, - nfs_access_policy: Optional[str] = None, + nfs_access_policy: Optional[str] = "default", **kwargs ): super(NamespaceJunction, self).__init__(**kwargs) @@ -1156,7 +1170,7 @@ class Nfs3Target(msrest.serialization.Model): """ _validation = { - 'target': {'pattern': r'^[-.0-9a-zA-Z]+$'}, + 'target': {'pattern': r'^[-.,0-9a-zA-Z]+$'}, } _attribute_map = { @@ -1526,11 +1540,12 @@ class StorageTarget(StorageTargetResource): :param 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 - :param provisioning_state: ARM provisioning state, see + :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". - :type provisioning_state: str or ~storage_cache_management_client.models.ProvisioningStateType + :vartype provisioning_state: str or + ~storage_cache_management_client.models.ProvisioningStateType :param nfs3: Properties when targetType is nfs3. :type nfs3: ~storage_cache_management_client.models.Nfs3Target :param clfs: Properties when targetType is clfs. @@ -1547,6 +1562,7 @@ class StorageTarget(StorageTargetResource): 'type': {'readonly': True}, 'location': {'readonly': True}, 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { @@ -1569,7 +1585,6 @@ def __init__( *, junctions: Optional[List["NamespaceJunction"]] = None, target_type: Optional[Union[str, "StorageTargetType"]] = None, - provisioning_state: Optional[Union[str, "ProvisioningStateType"]] = None, nfs3: Optional["Nfs3Target"] = None, clfs: Optional["ClfsTarget"] = None, unknown: Optional["UnknownTarget"] = None, @@ -1579,7 +1594,7 @@ def __init__( super(StorageTarget, self).__init__(**kwargs) self.junctions = junctions self.target_type = target_type - self.provisioning_state = provisioning_state + self.provisioning_state = None self.nfs3 = nfs3 self.clfs = clfs self.unknown = unknown @@ -1759,3 +1774,33 @@ def __init__( super(UsageModelsResult, self).__init__(**kwargs) self.next_link = next_link self.value = value + + +class UserAssignedIdentitiesValue(msrest.serialization.Model): + """UserAssignedIdentitiesValue. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the user-assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the user-assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + 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 a1894f66c562..585ed9e03fde 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 @@ -31,6 +31,8 @@ class CacheIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """ SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): 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 e3d6678db37e..f20bf4cd94a1 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 ._asc_operations_operations import AscOperationsOperations from ._caches_operations import CachesOperations from ._storage_targets_operations import StorageTargetsOperations +from ._storage_target_operations import StorageTargetOperations __all__ = [ 'Operations', @@ -20,4 +21,5 @@ 'AscOperationsOperations', 'CachesOperations', 'StorageTargetsOperations', + 'StorageTargetOperations', ] 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 efca5d8ed339..26daf2c8d8f9 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 @@ -67,7 +67,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL 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 dc556123e6b7..f16980d35710 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 @@ -64,7 +64,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" def prepare_request(next_link=None): @@ -134,7 +134,7 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" def prepare_request(next_link=None): @@ -197,7 +197,7 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL @@ -246,8 +246,8 @@ 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: 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 None or the result of cls(response) @@ -320,7 +320,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL @@ -369,7 +369,7 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -438,8 +438,8 @@ 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: 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 Cache or the result of cls(response) @@ -520,7 +520,7 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -576,7 +576,7 @@ def _debug_info_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL @@ -625,8 +625,8 @@ 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: 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 None or the result of cls(response) @@ -687,7 +687,7 @@ def _flush_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL @@ -737,8 +737,8 @@ 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: 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 None or the result of cls(response) @@ -799,7 +799,7 @@ def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL @@ -848,8 +848,8 @@ 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: 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 None or the result of cls(response) @@ -910,7 +910,7 @@ def _stop_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL @@ -959,8 +959,8 @@ 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: 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 None or the result of cls(response) @@ -1021,7 +1021,7 @@ def _upgrade_firmware_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL @@ -1071,8 +1071,8 @@ 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: 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 None or the result of cls(response) 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 e4fa9b6ec192..55dac6ba8bad 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 @@ -62,7 +62,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" def prepare_request(next_link=None): 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 7c463d69f999..aa1cec8d2ce3 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 @@ -62,7 +62,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" def prepare_request(next_link=None): 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 new file mode 100644 index 000000000000..66ec7c387a54 --- /dev/null +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_target_operations.py @@ -0,0 +1,403 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +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]] + +class StorageTargetOperations(object): + """StorageTargetOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~storage_cache_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _flush_initial( + self, + resource_group_name, # type: str + cache_name, # type: str + storage_target_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 = "2021-05-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 = 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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _flush_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/flush'} # type: ignore + + def begin_flush( + self, + resource_group_name, # type: str + cache_name, # type: str + storage_target_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Tells the cache to write all dirty data to the Storage Target's backend storage. Client + requests to this storage target's namespace will return errors until the flush operation + completes. + + :param resource_group_name: Target resource group. + :type resource_group_name: str + :param cache_name: Name of Cache. Length of name must not be greater than 80 and chars must be + from the [-0-9a-zA-Z_] char class. + :type cache_name: str + :param storage_target_name: Name of Storage Target. + :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. + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._flush_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + storage_target_name=storage_target_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_flush.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/flush'} # type: ignore + + def _suspend_initial( + self, + resource_group_name, # type: str + cache_name, # type: str + storage_target_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 = "2021-05-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 = 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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _suspend_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/suspend'} # type: ignore + + def begin_suspend( + self, + resource_group_name, # type: str + cache_name, # type: str + storage_target_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Suspends client access to a storage target. + + :param resource_group_name: Target resource group. + :type resource_group_name: str + :param cache_name: Name of Cache. Length of name must not be greater than 80 and chars must be + from the [-0-9a-zA-Z_] char class. + :type cache_name: str + :param storage_target_name: Name of Storage Target. + :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. + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._suspend_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + storage_target_name=storage_target_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_suspend.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/suspend'} # type: ignore + + def _resume_initial( + self, + resource_group_name, # type: str + cache_name, # type: str + storage_target_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 = "2021-05-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 = 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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _resume_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/resume'} # type: ignore + + def begin_resume( + self, + resource_group_name, # type: str + cache_name, # type: str + storage_target_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Resumes client access to a previously suspended storage target. + + :param resource_group_name: Target resource group. + :type resource_group_name: str + :param cache_name: Name of Cache. Length of name must not be greater than 80 and chars must be + from the [-0-9a-zA-Z_] char class. + :type cache_name: str + :param storage_target_name: Name of Storage Target. + :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. + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._resume_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + storage_target_name=storage_target_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_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 ad00875f1f9d..a86e90d23b17 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 @@ -60,7 +60,7 @@ def _dns_refresh_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL @@ -113,8 +113,8 @@ 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: 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 None or the result of cls(response) @@ -189,7 +189,7 @@ def list_by_cache( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" def prepare_request(next_link=None): @@ -246,6 +246,7 @@ def _delete_initial( resource_group_name, # type: str cache_name, # type: str storage_target_name, # type: str + force=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> None @@ -254,7 +255,7 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL @@ -270,6 +271,8 @@ def _delete_initial( # 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] @@ -293,6 +296,7 @@ def begin_delete( resource_group_name, # type: str cache_name, # type: str storage_target_name, # type: str + force=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -308,10 +312,13 @@ def begin_delete( :type cache_name: str :param storage_target_name: Name of Storage Target. :type storage_target_name: str + :param force: Boolean value requesting the force delete operation for a storage target. Force + delete discards unwritten-data in the cache instead of flushing it to back-end storage. + :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: 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 None or the result of cls(response) @@ -330,6 +337,7 @@ def begin_delete( resource_group_name=resource_group_name, cache_name=cache_name, storage_target_name=storage_target_name, + force=force, cls=lambda x,y,z: x, **kwargs ) @@ -389,7 +397,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" # Construct URL @@ -440,7 +448,7 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -514,8 +522,8 @@ 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: 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 StorageTarget or the result of cls(response) 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 633333158350..9bea74c0c270 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 @@ -62,7 +62,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" + api_version = "2021-05-01" accept = "application/json" def prepare_request(next_link=None): From 55b9a9c7be3e0329b94a7f72450cd059bf8aeb54 Mon Sep 17 00:00:00 2001 From: PythonSdkPipelines Date: Thu, 29 Jul 2021 01:44:36 +0000 Subject: [PATCH 2/2] version,CHANGELOG --- sdk/storage/azure-mgmt-storagecache/CHANGELOG.md | 12 ++++++++++++ .../azure/mgmt/storagecache/_version.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sdk/storage/azure-mgmt-storagecache/CHANGELOG.md b/sdk/storage/azure-mgmt-storagecache/CHANGELOG.md index 37865816f0bf..e030eb3bbf4d 100644 --- a/sdk/storage/azure-mgmt-storagecache/CHANGELOG.md +++ b/sdk/storage/azure-mgmt-storagecache/CHANGELOG.md @@ -1,5 +1,17 @@ # Release History +## 1.0.0 (2021-07-29) + +**Features** + + - Model CacheEncryptionSettings has a new parameter rotation_to_latest_key_version_enabled + - Model CacheIdentity has a new parameter user_assigned_identities + - Added operation group StorageTargetOperations + +**Breaking changes** + + - Operation StorageTargetsOperations.begin_delete has a new signature + ## 1.0.0b1 (2021-05-13) This is beta preview version. 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 e5754a47ce68..c47f66669f1b 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.0.0b1" +VERSION = "1.0.0"